Skip to content

Instantly share code, notes, and snippets.

@docteurklein
Created December 19, 2011 16:55
Show Gist options
  • Save docteurklein/1497965 to your computer and use it in GitHub Desktop.
Save docteurklein/1497965 to your computer and use it in GitHub Desktop.
avoid errors when binding empty propel collection to a symfony2 form
<?php
$callback = function($data = null) {
if (empty($data)) {
return new \PropelObjectCollection();
}
return $data;
};
$builder
->appendClientTransformer(new CallbackTransformer($callback, $callback));
;
@docteurklein
Copy link
Author

no problem anymore. I think it could be useful to either provide this dataTransformer in a PropelCollection type or describe the problem here: http://www.propelorm.org/cookbook/symfony2/mastering-symfony2-forms-with-propel.html

@willdurand
Copy link

willdurand commented Dec 20, 2011 via email

@docteurklein
Copy link
Author

interesting, I've maybe done something wrong. I'l try to dig into that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment