View Issue Details

IDProjectCategoryView StatusLast Update
429PHPOF2Defaultpublic23 Aug 2014 22:15
Reportermrosenquist Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Summary429: Assumptions made in fillFromArray and fillFromResult
DescriptionCurrently fillFromArray and fillFromResult initiate the change recording after populating from a result.

This assumes that an up to date record was populated correctly and straigh from the DB.

There are valid cases where these may be use on a pre populated result.

<?php
//$some_table is a valid PHPOF2 Table object
$some_row = $some_table->createRowObject();
$some_row->get(123); // A row is returned from the DB
/*
 * Assume some_row:123 has the following:
 * id = 123
 * title = 'One two three'
 * field1 = '1';
 * field2 = '2';
 */
$some_row->fillFromArray(array(
    'id' => 123,
    'field1' => 'One',
    'field2' => 'Two'
));
?>

In the example above initChangeRecording would have been called in the get (correct) and in fillFromArray (incorrect).

Additionally if the "get" had not been called the init change recording would not be started correctly.

In an ideal situation initChangeRecording would when needed load directly from the DB to insure the change recording is correct.

Would you be happy with a patch which goes in this direction?
TagsNo tags attached.

Activities

timj

23 Aug 2014 22:15

manager   ~481

The change recording is intended to track the difference between some kind of known state (i.e. a retrieve) and what a user/script actually submitted.

So to go back and retrieve data later (just before submitting a transaction) is not really consistent with the normal way of handling it.

I would suggest that instead, an option is added to fillFromArray() that prevents initChangeRecording from being called. Would this solve the issue?

Issue History

Date Modified Username Field Change
6 Aug 2014 08:53 mrosenquist New Issue
23 Aug 2014 22:15 timj Note Added: 481