/** * Load data fixtures with the passed EntityManager * * @param Doctrine\Common\Persistence\ObjectManager $manager */ function load(ObjectManager $manager) { $categoriesList = array('osobowe' => 'Samoloty osobowe i pasarzerskie', 'odrzutowe' => 'Samoloty odrzutowe', 'wojskowe' => 'Samoloty wojskowe', 'tajne' => 'Tajne rozwiązania'); foreach ($categoriesList as $key => $name) { $Category = new Category(); $Category->setTitle($name); $manager->persist($Category); // udostępnia referencje, użyte będie w PostsFixtures.php $this->addReference('category_' . $key, $Category); } $manager->flush(); }
/** * {@inheritDoc} */ public function preSave() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'preSave', array()); return parent::preSave(); }