Пример #1
0
 /**
  * @VirtualProperty()
  * @SerializedName("recurso_humano")
  * @Groups({"details"})
  */
 public function getRelatedId()
 {
     if ($this->recursoHumano) {
         return $this->recursoHumano->getId();
     }
     return null;
 }
 /**
  * @param \Concepto\Sises\ApplicationBundle\Entity\RecursoHumano $object
  * @param array                                                  $bag
  *
  * @return array
  */
 protected function preFlush($object, $bag = array())
 {
     $servicios = $bag['servicios'];
     /**
      * @var OrmPersistible $servicio
      * @var OrmPersistible $oServicio
      */
     foreach ($object->getServicios() as $servicio) {
         foreach ($servicios as $oKey => $oServicio) {
             if ($oServicio->getId() === $servicio->getId()) {
                 unset($servicios[$oKey]);
             }
         }
     }
     foreach ($servicios as $toDel) {
         $object->removeServicio($toDel);
         $this->getEm()->remove($toDel);
     }
     return parent::preFlush($object, $bag);
 }