public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) $this->_identifier["id"];
     }
     $this->__load();
     return parent::getId();
 }
Ejemplo n.º 2
0
 public static function toRepresentativeOwnerData(Representative $representative)
 {
     $data = ['id' => $representative->getId(), 'type' => $representative->getType(), 'official_title' => $representative->getOfficialTitle(), 'first_name' => $representative->getFirstName(), 'last_name' => $representative->getLastName(), 'avatar_file_path' => $representative->getAvatarFileName()];
     if ($representative->getStorageId()) {
         $data['storage_id'] = $representative->getStorageId();
     }
     return $data;
 }
 public function removeRepresentative(\Civix\CoreBundle\Entity\Representative $representative)
 {
     $this->getEntityManager()->createQueryBuilder()->update('CivixCoreBundle:Poll\\Question\\Representative r')->set('r.user', 'NULL')->where('r.user = :representativeId')->setParameter('representativeId', $representative->getId())->getQuery()->execute();
     $this->getEntityManager()->createQueryBuilder()->update('CivixCoreBundle:Activity a')->set('a.representative', 'NULL')->where('a.representative = :representativeId')->setParameter('representativeId', $representative->getId())->getQuery()->execute();
     $this->getEntityManager()->createQueryBuilder()->delete('CivixCoreBundle:Representative r')->where('r.id = :representativeId')->setParameter('representativeId', $representative->getId())->getQuery()->execute();
 }