public function load($manager)
	{
		for ($i = 0; $i < 10; $i++) {
			$comment = new DemoComment();
			$comment->setBody("DemoComment #{$i}");
			
			$manager->persist($comment);
		}
		
		$manager->flush();
	}
    public function doAction()
    {
		$em			= $this->get('doctrine.orm.entity_manager');

		$user 		= new DemoUser();
		$comment	= new DemoComment();
		
		$user->setName('DemoUser');
		$comment->setBody('DemoComment');
		
		$user->addComments($comment);
		
		$em->persist($user);
		$em->flush();
		

		return new Response('do .. done ..');
    }
Exemple #3
0
 /**
  * Add comments
  *
  * @param GoGreat\DemoBundle\Entity\DemoComment $comments
  */
 public function addComments(\GoGreat\DemoBundle\Entity\DemoComment $comments)
 {
 	$comments->setAuthor($this);
     $this->comments[] = $comments;
 }