Arkadiusz Dzięgiel committed ae45786

added more info to readme,
fix for extended propel queries

Comments (0)

Files changed (2)


 	public function queryFilter(&$script){
 		//until is not merged into propel
 		$script = preg_replace('/(protected function findPkSimple\(\$key, \$con\).*?)\$obj = new ([^(]+)[\(\)]{2}/s','$1\$cls = $2Peer::getOMClass();'."\n\t\t\t".'\$obj = new \$cls', $script);
+		//return correct isntance in query::create
+		$script = preg_replace('/(static function create\(.*?\$query = new )([^\(]+)/s','$1static', $script);
 	public function staticMethods($builder){
            $bundles = array(
-               new Glorpen\Propel\PropelBundle\PropelBundle(),
+               new Glorpen\Propel\PropelBundle\GlorpenPropelBundle(),
 You can implement **ContainerAwareInterface** on your model to get access to *Container* through built-in service. Container is injected in *model.construct* event.
+If you find yourself with error like `Serialization of 'Closure' is not allowed` it is probably about some not serializable services injected in model (since propel occasionally serializes and unserializes data).
 .. sourcecode:: php
 - preRollbackInsert
 - preRollbackDelete
+Be aware that when using transaction on big amount of model objects with on-demand formatter they still will be cached inside service so you can exhaust available php memory. 
 And example how you can use available hooks (code mostly borrowed from Symfony2 cookbook):
 .. sourcecode:: php
 Calls to Query::find(), Peer::populateObject() etc. will now return your extended class objects.
+In short it fixes:
+-  extending Model classes used by other bundles (eg. FOSUserBundle)
+-  queries/peer's returning proper isntances
+-  creating proper Query instance when calling `SomeQuery::create()` 
 FOSUserBundle and AdminGenerator