21493 Posts in 5784 Topics by 2622 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 853 Views |
-
Updating field value and update

26 November 2009 at 2:30am
Hi,
I have code that is as follows...
$childObject = DataObject::get_by_id($this->sourceClass, $ID);
$childObject->myfield = $new_data;
$childObject->write();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.
Barry
-
Re: Updating field value and update

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!
Barry
-
Re: Updating field value and update

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.
-
Re: Updating field value and update

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?
-
Re: Updating field value and update

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
| 853 Views | ||
|
Page:
1
|
Go to Top |


