<?php

namespace Plugin\ApteqPeriodical\Repository;

use Doctrine\ORM\QueryBuilder;
use Eccube\Repository\AbstractRepository;
use Eccube\Doctrine\Query\Queries;
use Plugin\ApteqPeriodical\Entity\Periodical;
use Plugin\ApteqPeriodical\Entity\PeriodicalDetail;
use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\ORM\NoResultException;
use Symfony\Bridge\Doctrine\RegistryInterface;

/**
 * ApteqPeriodicalRepository.
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class PeriodicalRepository extends AbstractRepository
{
    
    /**
     * PeriodicalRepository constructor.
     *
     * @param RegistryInterface $registry
     */
    public function __construct(RegistryInterface $registry)
    {
        parent::__construct($registry, Periodical::class);
    }
    /**
     * 定期情報を取得する.
     *
     * @param $OrderId
     *
     * @return QueryBuilder
     *
     */
    public function searchByPeriodicalId($PeriodicalId)
    {
        $result = $this->createQueryBuilder('pr')
            ->select('pr')
            ->where('pr.id = :PeriodicalId')
            ->setParameter('PeriodicalId', $PeriodicalId)
            ->getQuery()
            ->getResult();        

        return $result;
    }
 
}
