瀏覽代碼

findOneBySlug

feature/export_comptable
Guillaume 4 年之前
父節點
當前提交
27fcc697c2
共有 2 個文件被更改,包括 14 次插入0 次删除
  1. +7
    -0
      ShopBundle/Repository/ProductCategoryRepository.php
  2. +7
    -0
      ShopBundle/Repository/ProductFamilyRepository.php

+ 7
- 0
ShopBundle/Repository/ProductCategoryRepository.php 查看文件

@@ -28,6 +28,13 @@ class ProductCategoryRepository extends BaseRepository implements DefaultReposit
->orderBy('e.position', 'ASC');
}

public function findOneBySlug($slug)
{
$query = $this->findByMerchantQuery() ;
$query->andWhere('e.slug = :slug')->setParameter('slug',$slug) ;
return $query->getQuery()->getOneOrNullResult() ;
}

public function findAllParents($withOffline = false)
{
$query = $this->findByMerchantQuery()

+ 7
- 0
ShopBundle/Repository/ProductFamilyRepository.php 查看文件

@@ -36,6 +36,13 @@ class ProductFamilyRepository extends BaseRepository implements DefaultRepositor
return $query->getQuery()->getResult() ;
}

public function findOneBySlug($slug)
{
$query = $this->findByMerchantQuery() ;
$query->andWhere('e.slug = :slug')->setParameter('slug',$slug) ;
return $query->getQuery()->getOneOrNullResult() ;
}

public function getProductFamiliesByCategory($category){
$query = $this->findByMerchantQuery() ;
$query = $this->joinRelations($query) ;

Loading…
取消
儲存