Wednesday, September 29, 2010

New model obj doesn't get populated with data after set() and save()?

Hi all

Why is a new model object not populated with data etc. after creation?

$o = new Contract();
$o->create();
$o->set($this->getValidDataExcept(array('number' =>
'555-66-777')));
$o->save(); // The save works - an array with fields' data is
returned
debug($o->field('number')); // But now the $o seems to be not
populated at all anymore!

Do I have to manually pull the object again from the database and
can't just use the newly created one?

Thanks for help
Josh

Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.

You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: