コード例 #1
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $event1 = new Event();
     $event1->setName('Darth\'s surprise birthday party!');
     $event1->setLocation('Deathstar');
     $event1->setTime(new \DateTime('tomorrow noon'));
     $event1->setDetails('Darth HATES surprises!!');
     $manager->persist($event1);
     $event2 = new Event();
     $event2->setName('Rebellion Fundraiser Bake Sale!');
     $event2->setLocation('Endor');
     $event2->setTime(new \DateTime('Thursday noon'));
     $event2->setDetails('Ewok pies! Support the rebellion!');
     $manager->persist($event2);
     $manager->flush();
 }
コード例 #2
0
ファイル: LoadEvents.php プロジェクト: vikbert/starwarsevents
 public function load(ObjectManager $manager)
 {
     $event1 = new Event();
     $event1->setName('Darth\'s Birthday Party!');
     $event1->setLocation('Deathstar');
     $event1->setTime(new \DateTime('tomorrow noon'));
     $event1->setDetails('Ha! Darth HATES surprises!!!');
     $manager->persist($event1);
     $event3 = new Event();
     $event3->setName('Asia 2015 Symfony conference');
     $event3->setLocation('Beijing');
     $event3->setTime(new \DateTime('Thursday noon'));
     $event3->setDetails('Everybody who want to talk about symfony 2 framework');
     $manager->persist($event3);
     // the queries aren't done until now
     $manager->flush();
 }
コード例 #3
0
ファイル: LoadEvents.php プロジェクト: jinky32/symfony-play
 public function load(ObjectManager $manager)
 {
     $event1 = new Event();
     $event1->setName('My first event');
     $event1->setLocation('Waddesdon');
     //$event1->setTime(new \DateTime('tomorrownoon'));
     $event1->setTime(new \DateTime('tomorrow noon'));
     $event1->setDetails('He will love this!');
     $manager->persist($event1);
     $event2 = new Event();
     $event2->setName('My Second event');
     $event2->setLocation('Quatin');
     // $event2->setTime(new \DateTime('tomorrowlunchtime'));
     $event2->setTime(new \DateTime('tomorrow noon'));
     $event2->setDetails('He will hate this!');
     $manager->persist($event2);
     $manager->flush();
 }
コード例 #4
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $wayne = $manager->getRepository('UserBundle:User')->findOneByUsernameOrEmail('wayne');
     $event1 = new Event();
     $event1->setName('some event name');
     $event1->setLocation('some location');
     $event1->setTime(new \DateTime('tomorrow noon'));
     $event1->setDetails('some details to the event');
     $manager->persist($event1);
     $event2 = new Event();
     $event2->setName('event 2');
     $event2->setLocation('location 2');
     $event2->setTime(new \DateTime('Thursday noon'));
     $event2->setDetails('some details to the event');
     $manager->persist($event2);
     $event1->setOwner($wayne);
     $event2->setOwner($wayne);
     $manager->flush();
 }
コード例 #5
0
ファイル: LoadEvents.php プロジェクト: djanov/starwarsevents
 public function load(ObjectManager $manager)
 {
     $wayne = $manager->getRepository('UserBundle:User')->findOneByUsernameOrEmail('wayne');
     $event1 = new Event();
     $event1->setName('Darth\'s Birthday Party!');
     $event1->setLocation('Deathstar');
     $event1->setTime(new \DateTime('tomorrow noon'));
     $event1->setDetails('Ha! Darth HATES surprises!');
     $manager->persist($event1);
     $event2 = new Event();
     $event2->setName('Rebellion Fundraiser Bake Sale!');
     $event2->setLocation('Endor');
     $event2->setTime(new \DateTime('Thursday noon'));
     $event2->setDetails('Ewok pies! Support the rebellion!');
     $manager->persist($event2);
     $event1->setOwner($wayne);
     $event2->setOwner($wayne);
     $manager->flush();
 }
コード例 #6
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $user = $this->getReference('user-user');
     $event1 = new Event();
     $event1->setName('Darth\'s Birthday Party!');
     $event1->setLocation('Deathstar');
     $event1->setTime(new \DateTime('yesterday noon'));
     $event1->setDetails('Ha! Darth HATES surprises!!!');
     $event1->setOwner($user);
     $manager->persist($event1);
     $event2 = new Event();
     $event2->setName('Rebellion Fundraiser Bake Sale!');
     $event2->setLocation('Endor');
     $event2->setTime(new \DateTime('Thursday noon'));
     $event2->setDetails('Ewok pies! Support the rebellion!');
     $event2->setOwner($user);
     $manager->persist($event2);
     // the queries aren't done until now
     $manager->flush();
 }
コード例 #7
0
ファイル: play.php プロジェクト: jinky32/symfony-play
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
$loader = (require_once __DIR__ . '/app/bootstrap.php.cache');
Debug::enable();
require_once __DIR__ . '/app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$kernel->boot();
$container = $kernel->getContainer();
$container->enterScope('request');
$container->set('request', $request);
//$templating = $container->get('templating');
//
//echo $templating->render(
//    'EventBundle:Default:index.html.twig',
//    array(
//        'name'=>'Vader',
//        'count'=>3
//    )
//);
use Yoda\EventBundle\Entity\Event;
$event = new Event();
$event->setName('Darth\'s surprise birthday party!');
$event->setLocation('Dearth Star');
$event->setTime(new \DateTime('tomorrow noon'));
$event->setDetails('Ha he will hate this');
$em = $container->get('doctrine')->getManager();
$em->persist($event);
$em->flush();
コード例 #8
0
ファイル: debug.php プロジェクト: vallejos/StarWarsEventsDemo
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
$loader = (require_once __DIR__ . '/app/bootstrap.php.cache');
Debug::enable();
require_once __DIR__ . '/app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$kernel->boot();
$container = $kernel->getContainer();
$container->enterScope('request');
$container->set('request', $request);
/*
// Template
$templating = $container->get('templating');

echo $templating->render(
    'EventBundle:Default:index.html.twig',
    array('name' => 'Fabian Vallejos')
);
*/
use Yoda\EventBundle\Entity\Event;
$event = new Event();
$event->setName('Fabian\'s new post!');
$event->setLocation('fabianvallejos.com');
$event->setTime(new \DateTime('today'));
//$event->setDetails('An hack to quickly debug Symfony2 apps');
$em = $container->get('doctrine')->getManager();
$em->persist($event);
$em->flush();
コード例 #9
0
ファイル: play.php プロジェクト: vitor-silva/symfony-tutorial
<?php

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Debug\Debug;
$loader = (require_once __DIR__ . '/app/bootstrap.php.cache');
Debug::enable();
require_once __DIR__ . '/app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$kernel->boot();
$container = $kernel->getContainer();
$container->enterScope('request');
$container->set('request', $request);
use Yoda\EventBundle\Entity\Event;
$event = new Event();
$event->setName('some event name');
$event->setLocation('some location');
$event->setTime(new \DateTime('tomorrow noon'));
//$event->setDetails('some details to the event');
$em = $container->get('doctrine')->getManager();
$em->persist($event);
$em->flush();