Closed nixilla closed 12 years ago
Out of curiosity what is passing none images to this method? Thinking in terms of unit tests to try and prevent these things happening.
sfImagePoolable->setImages
call_user_func_array
Doctrine_Record->__call
sfDoctrineRecord->__call
CaseStudy->setImages
Doctrine_Record->fromArray
sfFormDoctrine->doUpdateObject
sfFormObject->updateObject
BaseCaseStudyForm->doSave
CaseStudyForm->doSave
sfFormObject->save
It looks like standard symfony stuff. The only difference is that on the form there are embed 4 sfImagePoolImageForms.
To be fair I think it's best if this throws an Exception if an sfImagePool object array is not passed as it helps with debugging.
As discussed the embedded forms with the new sfImagePool objects should be saved first, added to the Doctrine_Collection, unset those values in the $values array, and let the form do the saving. That way setImages never gets the array that it can't handle.
That embedded form could really do with more documentation :)
Looks like in some cases the sfImagePoolable::setImages receives an array of images which are not instances of sfImagePoolImage.
This results passing this instances to Doctrine_Collection::compareRecords which expects Doctrine_Record and call getOid on them.
This ends up with Fatal error "calling getOid on non-object".
This patch fixes this problem and shouldn't break anything, as all it does is ignoring non-sfImagePoolImage types.
Please merge.
Regards Janusz
P.S. The whitespace changes were made by vim - not me :-)