|
- <?php
-
- namespace Lc\ShopBundle\Repository;
-
- use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepositoryInterface;
- use Doctrine\ORM\EntityManager;
- use Doctrine\ORM\EntityRepository;
- use Symfony\Component\Security\Core\Security;
-
- class BaseRepository extends EntityRepository implements ServiceEntityRepositoryInterface
- {
- /**
- * @param string $entityClass The class name of the entity this repository manages
- */
- public function __construct(EntityManager $entityManager, $entityClass)
- {
- parent::__construct($entityManager, $entityManager->getClassMetadata($entityClass));
- }
-
- public function findAllOfflineAndDelete()
- {
-
- return $this->createQueryBuilder('e')
- ->andWhere('e.status < = 0')
- ->orderBy('e.status', "DESC")
- ->getQuery()
- ->getResult();
-
- }
-
- public function filterByMerchant($merchant){
- return $this->createQueryBuilder('e')
- ->where('e.merchant = :currentMerchant')
- ->setParameter('currentMerchant', $merchant->getId())
- ->getQuery()
- ->getResult();
- }
-
- public function findByMerchantQuery($merchant)
- {
- return $this->createQueryBuilder('e')
- ->where('e.merchant = :currentMerchant')
- ->setParameter('currentMerchant', $merchant->getId()) ;
- }
-
- public function findOneByDevAlias($devAlias, $merchant)
- {
- return $this->findByMerchantQuery($merchant)
- ->where('e.devAlias = :devAlias')
- ->andWhere('e.status = 1')
- ->setParameter('devAlias', $devAlias)
- ->getQuery()
- ->getResult();
- }
-
-
- }
|