21493 Posts in 5784 Topics by 2622 members
|Go to End|
26 November 2009 at 2:30am
I have code that is as follows...
$childObject = DataObject::get_by_id($this->sourceClass, $ID);
$childObject->myfield = $new_data;
and the $new data is not getting to the written back to the database.
I have tried $childObject->forceChange(); before the write and tried $childObject->write(false,false,true); to force the write to write... I have also output the $childObject->myfield after being set and can confirm $new_data is in there...
...what else can I do to ensure I write this data back?
Any help much appreciated.
26 November 2009 at 3:32am
Arrrrggh! This is my third thread and replied to all of them fixing them soon after raising it.
Turns out 'myfield' in $childObject->myfield = $new_data; was spelt incorrectly and there is no failure, no report of setting a field that doesn't exist... I guess this is a great feature that I did not know about!
Next time maybe I'll need some help from you guys!
26 November 2009 at 4:47am
No no no, self help is good! Glad you got it sorted out, I know I'd do this all the time if it wasn't for auto-complete in NetBeans.
26 November 2009 at 5:06am
Thanks Dale, I am using Notepad++ with an FTP plugin at the moment... not the best IDE... I was (as soon as a new project starts up) start going to use PHPEclipse with code completion, goto declaration and debugging... how would that compare with NetBeans?
26 November 2009 at 6:45am
They are very similar in capabilities. I prefer NetBeans because all the goodies (SVN, SQL browser, xdebug) are part of the core platform, and Eclipse always makes me install a dozen plugins to get it to a usable state.
Both will be a great improvement over your current setup. More at http://doc.silverstripe.org/doku.php?id=tools
|Go to Top|