/**
  * verify authentication
  */
 public function verificaAuth()
 {
     $this->identity = $this->auth->getStorage()->read();
     if (!$this->auth->hasIdentity()) {
         //there is no id?
         $this->redirect()->toRoute('Locador/logoff');
     } else {
         $this->locador = $this->identity[0];
         $this->layout()->locador = $this->locador;
         $visitas = $this->getEm()->getRepository("MyClasses\\Entities\\Locador")->find($this->locador->getId())->getVisitas()->filter(function ($visita) {
             return $visita->getStatus() == "agendada";
         })->count();
         $this->layout()->visitas = $visitas;
     }
 }
 /**
  * {@inheritDoc}
  */
 public function getId()
 {
     if ($this->__isInitialized__ === false) {
         return (int) parent::getId();
     }
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getId', array());
     return parent::getId();
 }