Exemplo n.º 1
0
 protected function processForm(ModelInterface $entity, array $parameters, $method = 'PUT')
 {
     /**
      * @var TutorialInterface $entity
      */
     if (null === $entity->getAuthor()) {
         $entity->setAuthor($this->getUserRole());
     }
     return parent::processForm($entity, $parameters, $method);
 }
Exemplo n.º 2
0
 /**
  * @param ModelInterface $entity
  * @return void
  */
 public function save(ModelInterface $entity)
 {
     if (!$entity instanceof CourseInterface) {
         throw new InvalidArgumentException('expect an CourseInterface object');
     }
     $hashTag = $entity->getHashTag();
     $course = $this->repository->getCourseByHashTag($hashTag);
     if ($course instanceof CourseInterface) {
         $entity->setHashTag($hashTag . uniqid("", true));
     }
     $this->em->persist($entity);
     $this->em->flush();
 }