public function getClassPhaseDDC(\TRC\CoreBundle\Entity\DDC\PDDC $phase) { if ($phase->getActive()) { return 'encours'; } else { if (!is_null($phase->getDatefin())) { return 'terminer'; } else { return 'avenir'; } } }
public function initPhases(\TRC\CoreBundle\Entity\DDC\DDC $ddc) { $phases = $this->em->getRepository('TRCCoreBundle:DDC\\Phase')->findBy(array(), array("id" => "asc"), null, 0); foreach ($phases as $key => $phase) { # code... $pddc = new PDDC(); $pddc->setDdc($ddc); $pddc->setPhase($phase); $this->em->persist($pddc); $etats = $this->em->getRepository('TRCCoreBundle:DDC\\Etat')->findBy(array("phase" => $phase), array("id" => "asc"), null, 0); foreach ($etats as $cle => $etat) { $eddc = new EDDC(); $eddc->setPddc($pddc); $eddc->setEtat($etat); $eddc->setVerdict($etat->getDecision()); $this->em->persist($eddc); } } $this->em->flush(); return true; }
/** * {@inheritDoc} */ public function getActive() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getActive', []); return parent::getActive(); }