public function serialize()
 {
     $responsavel['id'] = $this->responsavel->getId();
     $responsavel['nome'] = $this->responsavel->getNome();
     $responsavel['cpf'] = $this->responsavel->getCpf();
     $responsavel['email'] = $this->responsavel->getEmail();
     if (!is_null($this->responsavel->getEmpresa())) {
         $empresaSerialize = new EmpresaSerializer($this->responsavel->getEmpresa());
         $responsavel['empresa'] = $empresaSerialize->serialize();
     } else {
         $responsavel['empresa'] = null;
     }
     $responsavel['createdAt'] = $this->responsavel->getCreatedAt();
     $responsavel['updatedAt'] = $this->responsavel->getUpdatedAt();
     return $responsavel;
 }
 public function findById($id)
 {
     $repository = $this->em->getRepository('Code\\Sistema\\Entity\\Empresa')->find($id);
     $empresas = [];
     if ($repository != null) {
         $serializer = new EmpresaSerializer($repository);
         $empresas[] = $serializer->serialize();
     }
     return $empresas;
 }