Search Results

Search found 1 results on 1 pages for 'tony908'.

Page 1/1 | 1 

  • Sonata Media Bundle sortBy created_at

    - by tony908
    I use SonataMediaBundle and i would like sort Gallery by created_at field. In repository class i have (without orderBy working good!): $qb = $this->createQueryBuilder('m') ->orderBy('j.expires_at', 'DESC'); $query = $qb->getQuery(); return $query->getResult(); and this throw error: An exception has been thrown during the rendering of a template ("[Semantical Error] line 0, col 80 near 'created_at D': Error: Class Application\Sonata\MediaBundle\Entity\Gallery has no field or association named created_at") so i add this field to Gallery class: /** * @var \DateTime */ private $created_at; /** * Set created_at * * @param \DateTime $createdAt * @return Slider */ public function setCreatedAt($createdAt) { $this->created_at = $createdAt; return $this; } /** * Get created_at * * @return \DateTime */ public function getCreatedAt() { return $this->created_at; } but now i have error: FatalErrorException: Compile Error: Declaration of Application\Sonata\MediaBundle\Entity\Gallery::setCreatedAt() must be compatible with Sonata\MediaBundle\Model\GalleryInterface::setCreatedAt(DateTime $createdAt = NULL) in /home/tony/www/test/Application/Sonata/MediaBundle/Entity/Gallery.php line 32 GalleryInterface: https://github.com/sonata-project/SonataMediaBundle/blob/master/Model/GalleryInterface.php So... how can i use sortBy in my example?

    Read the article

1