src/Eccube/Repository/LayoutRepository.php line44

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) EC-CUBE CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.ec-cube.co.jp/
  8.  *
  9.  * For the full copyright and license information, please view the LICENSE
  10.  * file that was distributed with this source code.
  11.  */
  12. namespace Eccube\Repository;
  13. use Doctrine\ORM\NoResultException;
  14. use Eccube\Entity\Layout;
  15. use Symfony\Bridge\Doctrine\RegistryInterface;
  16. /**
  17.  * LayoutRepository
  18.  *
  19.  * This class was generated by the Doctrine ORM. Add your own custom
  20.  * repository methods below.
  21.  */
  22. class LayoutRepository extends AbstractRepository
  23. {
  24.     public function __construct(RegistryInterface $registry)
  25.     {
  26.         parent::__construct($registryLayout::class);
  27.     }
  28.     public function get($id)
  29.     {
  30.         try {
  31.             $Layout $this->createQueryBuilder('l')
  32.                 ->select('l, bp, b')
  33.                 ->leftJoin('l.BlockPositions''bp')
  34.                 ->leftJoin('bp.Block''b')
  35.                 ->where('l.id = :id')
  36.                 ->orderBy('bp.block_row''ASC')
  37.                 ->setParameter('id'$id)
  38.                 ->getQuery()
  39.                 ->useResultCache(true$this->getCacheLifetime())
  40.                 ->getSingleResult();
  41.         } catch (NoResultException $e) {
  42.             return null;
  43.         }
  44.         return $Layout;
  45.     }
  46. }