Last active
October 14, 2015 20:34
-
-
Save pedrorvidal/2aba1cd81820892f4f71 to your computer and use it in GitHub Desktop.
Erro no controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $arrayRelacoes = array(); | |
| if (!is_null($idNoticia)) { | |
| $relacoes = $this->getEm()->getRepository('Entity\NoticiaGaleria')->getNoticiaGaleriaIdsNoticias($idNoticia); | |
| foreach ($relacoes as $relacao) { | |
| $arrayRelacoes[$relacao->getGaleria()->getId()] = $relacao->getPosicaoPagina(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Entity\Repository; | |
| use \Doctrine\ORM\EntityRepository; | |
| /** | |
| * Description of NoticiaGaleriaRepository | |
| * | |
| * @author Vidal | |
| */ | |
| class NoticiaGaleriaRepository extends BaseRepository | |
| { | |
| /** | |
| * | |
| * @param array $ids | |
| * @return array | |
| */ | |
| public function getNoticiaGaleriaIdsNoticias($id) | |
| { | |
| $dql = "SELECT ng FROM Entity\NoticiaGaleria ng JOIN ng.noticia nt WHERE nt.id = {$id} "; | |
| $query = $this->getEntityManager()->createQuery($dql); | |
| return $query->getResult(); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Entity; | |
| use Doctrine\ORM\Mapping as ORM; | |
| /** | |
| * NoticiaGaleria | |
| * | |
| * @ORM\Table(name="tb_noticia_galeria", indexes={@ORM\Index(name="IDX_3135593E478D78F9", columns={"id_galeria"}), @ORM\Index(name="IDX_3135593ED8407959", columns={"id_noticia"})}) | |
| * @ORM\Entity(repositoryClass="Entity\Repository\NoticiaGaleriaRepository") | |
| */ | |
| class NoticiaGaleria extends AbstractEntity implements EntityInterface | |
| { | |
| /** | |
| * @var integer | |
| * | |
| * @ORM\Column(name="id_noticia_galeria", type="bigint", nullable=false) | |
| * @ORM\Id | |
| * @ORM\GeneratedValue(strategy="SEQUENCE") | |
| * @ORM\SequenceGenerator(sequenceName="tb_noticia_galeria_id_noticia_galeria_seq", allocationSize=1, initialValue=1) | |
| */ | |
| private $id; | |
| /** | |
| * @var integer | |
| * | |
| * @ORM\Column(name="st_posicao_pagina", type="bigint", nullable=false) | |
| */ | |
| private $posicaoPagina; | |
| /** | |
| * @var Galeria | |
| * | |
| * @ORM\ManyToOne(targetEntity="Galeria") | |
| * @ORM\JoinColumns({ | |
| * @ORM\JoinColumn(name="id_galeria", referencedColumnName="id_galeria") | |
| * }) | |
| */ | |
| private $galeria; | |
| /** | |
| * @var Noticia | |
| * | |
| * @ORM\ManyToOne(targetEntity="Noticia") | |
| * @ORM\JoinColumns({ | |
| * @ORM\JoinColumn(name="id_noticia", referencedColumnName="id_noticia") | |
| * }) | |
| */ | |
| private $noticia; | |
| /** | |
| * | |
| * @return integer | |
| */ | |
| public function getId() | |
| { | |
| return $this->id; | |
| } | |
| /** | |
| * | |
| * @return integer | |
| */ | |
| public function getPosicaoPagina() | |
| { | |
| return $this->posicaoPagina; | |
| } | |
| /** | |
| * | |
| * @return Galeria | |
| */ | |
| public function getGaleria() | |
| { | |
| return $this->galeria; | |
| } | |
| /** | |
| * | |
| * @return Noticia | |
| */ | |
| public function getNoticia() | |
| { | |
| return $this->Noticia; | |
| } | |
| /** | |
| * | |
| * @param integer $id | |
| */ | |
| public function setId($id) | |
| { | |
| $this->id = $id; | |
| } | |
| /** | |
| * | |
| * @param integer $posicaoPagina | |
| */ | |
| public function setPosicaoPagina($posicaoPagina) | |
| { | |
| $this->posicaoPagina = $posicaoPagina; | |
| } | |
| /** | |
| * | |
| * @param Galeria $galeria | |
| */ | |
| public function setGaleria(Galeria $galeria) | |
| { | |
| $this->galeria = $galeria; | |
| } | |
| /** | |
| * | |
| * @param Noticia $noticia | |
| */ | |
| public function setNoticia(Noticia $noticia) | |
| { | |
| $this->noticia = $noticia; | |
| } | |
| /** | |
| * | |
| * @return integer | |
| */ | |
| public function getLabel() | |
| { | |
| return $this->getPosicaoPagina(); | |
| } | |
| /** | |
| * | |
| * @return array | |
| */ | |
| public function toArray() | |
| { | |
| return array( | |
| "id" => $this->getId(), | |
| "noticia" => $this->getNoticia(), | |
| "galeria" => $this->getGaleria(), | |
| "posicaoPagina" => $this->getPosicaoPagina() | |
| ); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Entity; | |
| use Doctrine\ORM\Mapping as ORM; | |
| /** | |
| * PaginaEstaticaGaleria | |
| * | |
| * @ORM\Table(name="tb_pagina_estatica_galeria", indexes={@ORM\Index(name="IDX_3135593E478D78F9", columns={"id_galeria"}), @ORM\Index(name="IDX_3135593ED8407959", columns={"id_pagina_estatica"})}) | |
| * @ORM\Entity(repositoryClass="Entity\Repository\PaginaEstaticaGaleriaRepository") | |
| */ | |
| class PaginaEstaticaGaleria extends AbstractEntity implements EntityInterface | |
| { | |
| /** | |
| * @var integer | |
| * | |
| * @ORM\Column(name="id_pagina_estatica_galeria", type="bigint", nullable=false) | |
| * @ORM\Id | |
| * @ORM\GeneratedValue(strategy="SEQUENCE") | |
| * @ORM\SequenceGenerator(sequenceName="tb_pagina_estatica_galeria_id_pagina_estatica_galeria_seq", allocationSize=1, initialValue=1) | |
| */ | |
| private $id; | |
| /** | |
| * @var integer | |
| * | |
| * @ORM\Column(name="st_posicao_pagina", type="bigint", nullable=false) | |
| */ | |
| private $posicaoPagina; | |
| /** | |
| * @var Galeria | |
| * | |
| * @ORM\ManyToOne(targetEntity="Galeria") | |
| * @ORM\JoinColumns({ | |
| * @ORM\JoinColumn(name="id_galeria", referencedColumnName="id_galeria") | |
| * }) | |
| */ | |
| private $galeria; | |
| /** | |
| * @var PaginaEstatica | |
| * | |
| * @ORM\ManyToOne(targetEntity="PaginaEstatica") | |
| * @ORM\JoinColumns({ | |
| * @ORM\JoinColumn(name="id_pagina_estatica", referencedColumnName="id_pagina_estatica") | |
| * }) | |
| */ | |
| private $paginaEstatica; | |
| /** | |
| * | |
| * @return integer | |
| */ | |
| public function getId() | |
| { | |
| return $this->id; | |
| } | |
| /** | |
| * | |
| * @return integer | |
| */ | |
| public function getPosicaoPagina() | |
| { | |
| return $this->posicaoPagina; | |
| } | |
| /** | |
| * | |
| * @return Galeria | |
| */ | |
| public function getGaleria() | |
| { | |
| return $this->galeria; | |
| } | |
| /** | |
| * | |
| * @return PaginaEstatica | |
| */ | |
| public function getPaginaEstatica() | |
| { | |
| return $this->paginaEstatica; | |
| } | |
| /** | |
| * | |
| * @param integer $id | |
| */ | |
| public function setId($id) | |
| { | |
| $this->id = $id; | |
| } | |
| /** | |
| * | |
| * @param integer $posicaoPagina | |
| */ | |
| public function setPosicaoPagina($posicaoPagina) | |
| { | |
| $this->posicaoPagina = $posicaoPagina; | |
| } | |
| /** | |
| * | |
| * @param Galeria $galeria | |
| */ | |
| public function setGaleria(Galeria $galeria) | |
| { | |
| $this->galeria = $galeria; | |
| } | |
| /** | |
| * | |
| * @param PaginaEstatica $paginaEstatica | |
| */ | |
| public function setPaginaEstatica(PaginaEstatica $paginaEstatica) | |
| { | |
| $this->paginaEstatica = $paginaEstatica; | |
| } | |
| /** | |
| * | |
| * @return integer | |
| */ | |
| public function getLabel() | |
| { | |
| return $this->getPosicaoPagina(); | |
| } | |
| /** | |
| * | |
| * @return array | |
| */ | |
| public function toArray() | |
| { | |
| return array( | |
| "id" => $this->getId(), | |
| "paginaEstatica" => $this->getPaginaEstatica(), | |
| "galeria" => $this->getGaleria(), | |
| "posicaoPagina" => $this->getPosicaoPagina() | |
| ); | |
| } | |
| } |
Author
Author
getEntityManager()->createQuery($dql);
return $query->getResult();
}
}
O $teste..... está na linha 329 do arquivo NoticiaController.php?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
perae que postei o erro "errado"