container = $container; } public function load(ObjectManager $manager) { $author = new Author(); $author->setName('Author'); $model = new Model(); $model->setId(1); $model->setAuthor($author); $model->setModified(new \DateTime()); $model->setName('Name'); $manager->persist($model); $manager->flush(); } }