コード例 #1
0
ファイル: LoadStateData.php プロジェクト: JahHub/fertilizer
 /**
  * @param string $id
  * @param string $name
  *
  * @return State
  */
 public function createState($id, $name)
 {
     $state = new State();
     $state->setName($name);
     $this->setEntityId($state, $id);
     return $state;
 }
コード例 #2
0
 /**
  * {@inheritDoc}
  */
 public function load(ObjectManager $manager)
 {
     $state = new State();
     $state->setName('Ingresado');
     $manager->persist($state);
     $project = new Project();
     $project->setName('Project 1');
     $manager->persist($project);
     $parentTask = new Task();
     $parentTask->setTitle('Parent task 1');
     $parentTask->setDescription('Lorem ipsum ad his scripta blandit partiendo, eum fastidii accumsan euripidis in, eum liber hendrerit an. Qui ut wisi vocibus suscipiantur, quo dicit ridens inciderint id. Quo mundi lobortis reformidans eu, legimus senserit definiebas an eos. Eu sit tincidunt incorrupte definitionem, vis mutat affert percipit cu, eirmod consectetuer signiferumque eu per. In usu latine equidem dolores. Quo no falli viris intellegam, ut fugit veritus placerat per.');
     $parentTask->setPublishedAt(new \DateTime());
     $parentTask->setProject($project);
     $parentTask->setState($state);
     $manager->persist($parentTask);
     $timeEntry = new TimeEntry();
     $timeEntry->setTask($parentTask);
     $timeEntry->setDate(new \DateTime());
     $timeEntry->setHours(8);
     $timeEntry->setComment('Lorem ipsum ad his scripta blandit partiendo');
     $manager->persist($timeEntry);
     $manager->flush();
     for ($i = 1; $i <= 5; $i++) {
         $task = new Task();
         $task->setTitle('Task ' . $i);
         $task->setDescription('Lorem ipsum ad his scripta blandit partiendo, eum fastidii accumsan euripidis in, eum liber hendrerit an. Qui ut wisi vocibus suscipiantur, quo dicit ridens inciderint id. Quo mundi lobortis reformidans eu, legimus senserit definiebas an eos. Eu sit tincidunt incorrupte definitionem, vis mutat affert percipit cu, eirmod consectetuer signiferumque eu per. In usu latine equidem dolores. Quo no falli viris intellegam, ut fugit veritus placerat per.');
         $task->setPublishedAt(new \DateTime());
         $task->setProject($project);
         $task->setState($state);
         $task->setParent($parentTask);
         $manager->persist($task);
     }
     $manager->flush();
     $state = new State();
     $state->setName('En curso');
     $manager->persist($state);
     $project = new Project();
     $project->setName('Project 2');
     $manager->persist($project);
     $parentTask = new Task();
     $parentTask->setTitle('Parent task 2');
     $parentTask->setDescription('Lorem ipsum ad his scripta blandit partiendo, eum fastidii accumsan euripidis in, eum liber hendrerit an. Qui ut wisi vocibus suscipiantur, quo dicit ridens inciderint id. Quo mundi lobortis reformidans eu, legimus senserit definiebas an eos. Eu sit tincidunt incorrupte definitionem, vis mutat affert percipit cu, eirmod consectetuer signiferumque eu per. In usu latine equidem dolores. Quo no falli viris intellegam, ut fugit veritus placerat per.');
     $parentTask->setPublishedAt(new \DateTime());
     $parentTask->setProject($project);
     $parentTask->setState($state);
     $manager->persist($parentTask);
     $timeEntry = new TimeEntry();
     $timeEntry->setTask($parentTask);
     $timeEntry->setDate(new \DateTime());
     $timeEntry->setHours(8);
     $timeEntry->setComment('Lorem ipsum ad his scripta blandit partiendo');
     $manager->persist($timeEntry);
     $manager->flush();
     for ($i = $i; $i <= 10; $i++) {
         $task = new Task();
         $task->setTitle('Task ' . $i);
         $task->setDescription('Lorem ipsum ad his scripta blandit partiendo, eum fastidii accumsan euripidis in, eum liber hendrerit an. Qui ut wisi vocibus suscipiantur, quo dicit ridens inciderint id. Quo mundi lobortis reformidans eu, legimus senserit definiebas an eos. Eu sit tincidunt incorrupte definitionem, vis mutat affert percipit cu, eirmod consectetuer signiferumque eu per. In usu latine equidem dolores. Quo no falli viris intellegam, ut fugit veritus placerat per.');
         $task->setPublishedAt(new \DateTime());
         $task->setProject($project);
         $task->setState($state);
         $task->setParent($parentTask);
         $manager->persist($task);
     }
     $manager->flush();
     $state = new State();
     $state->setName('Finalizado');
     $manager->persist($state);
     $project = new Project();
     $project->setName('Project 3');
     $manager->persist($project);
     $parentTask = new Task();
     $parentTask->setTitle('Parent task 3');
     $parentTask->setDescription('Lorem ipsum ad his scripta blandit partiendo, eum fastidii accumsan euripidis in, eum liber hendrerit an. Qui ut wisi vocibus suscipiantur, quo dicit ridens inciderint id. Quo mundi lobortis reformidans eu, legimus senserit definiebas an eos. Eu sit tincidunt incorrupte definitionem, vis mutat affert percipit cu, eirmod consectetuer signiferumque eu per. In usu latine equidem dolores. Quo no falli viris intellegam, ut fugit veritus placerat per.');
     $parentTask->setPublishedAt(new \DateTime());
     $parentTask->setProject($project);
     $parentTask->setState($state);
     $timeEntry = new TimeEntry();
     $timeEntry->setTask($parentTask);
     $timeEntry->setDate(new \DateTime());
     $timeEntry->setHours(8);
     $timeEntry->setComment('Lorem ipsum ad his scripta blandit partiendo');
     $manager->persist($timeEntry);
     $manager->persist($parentTask);
     $manager->flush();
     for ($i = $i; $i <= 15; $i++) {
         $task = new Task();
         $task->setTitle('Task ' . $i);
         $task->setDescription('Lorem ipsum ad his scripta blandit partiendo, eum fastidii accumsan euripidis in, eum liber hendrerit an. Qui ut wisi vocibus suscipiantur, quo dicit ridens inciderint id. Quo mundi lobortis reformidans eu, legimus senserit definiebas an eos. Eu sit tincidunt incorrupte definitionem, vis mutat affert percipit cu, eirmod consectetuer signiferumque eu per. In usu latine equidem dolores. Quo no falli viris intellegam, ut fugit veritus placerat per.');
         $task->setPublishedAt(new \DateTime());
         $task->setProject($project);
         $task->setState($state);
         $task->setParent($parentTask);
         $manager->persist($task);
     }
     $manager->flush();
 }