for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/*
* This file is part of the Sylius package.
*
* (c) Paweł Jędrzejewski
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sylius\Bundle\CoreBundle\Doctrine\ORM;
use Sylius\Bundle\ResourceBundle\Doctrine\ORM\EntityRepository;
use Sylius\Component\Core\Model\CustomerInterface;
use Sylius\Component\Core\Repository\AddressRepositoryInterface;
/**
* @author Anna Walasek <[email protected]>
* @author Jan Góralski <[email protected]>
class AddressRepository extends EntityRepository implements AddressRepositoryInterface
{
* {@inheritdoc}
public function findByCustomer(CustomerInterface $customer)
return $this->createQueryBuilder('o')
->leftJoin('o.customer', 'customer')
->where('customer = :customer')
->setParameter('customer', $customer)
->getQuery()
->getResult()
;
}
public function findOneByCustomer($id, CustomerInterface $customer)
->andWhere('o.id = :id')
->andWhere('customer = :customer')
->setParameter('id', $id)
->getOneOrNullResult()