I have an array of values โโthat I want to update using my model.
Doctrine_Access provides the setArray function, which is almost completely consistent with me, except that it takes care of values โโthat have no fields in the model. I want them to be ignored.
A small example. Say we have a User table with a field username.
$user = new User();
$user->setArray(array('username'=>'xyz'))->save();
That would work!
$user = new User();
$user->setArray(array('username'=>'xyz','anotherKey'=>'anotherValue'))->save();
This is not true. I want the Doctrine to simply ignore anotherKey if there is no related area. It is assumed that I do not want to filter my arrays before updating my model.
What is the cleanest and easiest way to do this?
source
share