Ejemplo n.º 1
0
 public function prePersist(Show $show, LifecycleEventArgs $event)
 {
     if (!$show->getPrimaryRef()) {
         $refname = Sluggable\Urlizer::urlize($show->getName(), '_');
         if ($show->getStartAt()) {
             $year = $show->getStartAt()->format('y');
             $refname = $year . '/' . $refname;
         }
         $ref = new ShowRef();
         $ref->setShow($show);
         $ref->setRef($refname);
         $show->setPrimaryRef($ref);
     }
 }