예제 #1
0
 /**
  * {@inheritdoc}
  */
 public function getNewInstance()
 {
     $object = parent::getNewInstance();
     $inspection = new Inspection();
     $inspection->setDate(new \DateTime());
     $inspection->setComment("Initial inspection");
     $object->addInspection($inspection);
     return $object;
 }
예제 #2
0
파일: CarAdmin.php 프로젝트: plusteams/xxxx
 /**
  * {@inheritdoc}
  */
 public function getNewInstance()
 {
     $car = parent::getNewInstance();
     $userAdmin = $this->getConfigurationPool()->getAdminByAdminCode('sonata.user.admin.user');
     $user = $userAdmin->getModelManager()->findOneBy($userAdmin->getClass(), array('username' => 'admin'));
     $inspection = new Inspection();
     $inspection->setDate(new \DateTime());
     $inspection->setComment("Initial inspection");
     $inspection->setInspector($user);
     $car->addInspection($inspection);
     return $car;
 }
예제 #3
0
파일: Car.php 프로젝트: plusteams/xxxx
 /**
  * @param Inspection $inspection
  * @return void
  */
 public function addInspection(Inspection $inspection)
 {
     $inspection->setCar($this);
     $this->inspections->add($inspection);
 }