コード例 #1
0
 /**
  * @Route("/hello/{name}")
  * @Template()
  */
 public function indexAction($name)
 {
     $post = new Post();
     $post->setTitle('Titre du post');
     $post->setBody('Corps du post');
     $em = $this->getDoctrine()->getManager();
     // A finir
     return array('name' => $name);
 }
コード例 #2
0
 public function load(ObjectManager $manager)
 {
     for ($i = 0; $i < 100; $i++) {
         $post = new Post();
         $post->setTitle(sprintf('Titre du post n°%d', $i));
         $post->setBody(sprintf('Corps du post n°%d', $i));
         $post->setPublished($i % 2);
         $manager->persist($post);
     }
     // To finish
 }