浏览代码

up baserepo

reduction
Fab 4 年前
父节点
当前提交
4480a2152d
共有 3 个文件被更改,包括 110 次插入2 次删除
  1. +10
    -2
      ShopBundle/Repository/BaseRepository.php
  2. +73
    -0
      ShopBundle/Repository/PointSaleRepository.php
  3. +27
    -0
      ShopBundle/Resources/views/backend/order/panel_delivery.html.twig

+ 10
- 2
ShopBundle/Repository/BaseRepository.php 查看文件

@@ -16,8 +16,6 @@ class BaseRepository extends EntityRepository implements ServiceEntityRepository
*/
public function __construct(EntityManager $entityManager, $entityClass)
{


parent::__construct($entityManager, $entityManager->getClassMetadata($entityClass));
}

@@ -32,5 +30,15 @@ class BaseRepository extends EntityRepository implements ServiceEntityRepository

}

public function filterByMerchant($merchant){
dump($merchant);
return $this->createQueryBuilder('e')
->where('e.merchant = :currentMerchant')
->setParameter('currentMerchant', $merchant->getId())
->getQuery()
->getResult();

}


}

+ 73
- 0
ShopBundle/Repository/PointSaleRepository.php 查看文件

@@ -0,0 +1,73 @@
<?php

namespace Lc\ShopBundle\Repository;

use Doctrine\Common\Persistence\ManagerRegistry;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\QueryBuilder;
use Lc\ShopBundle\Context\ProductCategoryInterface;

/**
* @method ProductCategoryInterface|null find($id, $lockMode = null, $lockVersion = null)
* @method ProductCategoryInterface|null findOneBy(array $criteria, array $orderBy = null)
* @method ProductCategoryInterface[] findAll()
* @method ProductCategoryInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class ProductCategoryRepository extends BaseRepository
{
public function __construct(EntityManager $entityManager)
{

parent::__construct($entityManager, ProductCategoryInterface::class);
}


public static function adminQueryBuilderForTree(BaseRepository $e): QueryBuilder
{

return $e->createQueryBuilder('e')
->where('e.parent is NULL')
->andWhere('e.status >= 0')
->orderBy('e.position', 'ASC');
}

public function findAllParents()
{
return $this->createQueryBuilder('e')
->where('e.parent is NULL')
->andWhere('e.status >= 0')
->orderBy('e.position', 'ASC')
->getQuery()
->getResult();
}


// /**
// * @return ProductCategory[] Returns an array of ProductCategory objects
// */
/*
public function findByExampleField($value)
{
return $this->createQueryBuilder('p')
->andWhere('p.exampleField = :val')
->setParameter('val', $value)
->orderBy('p.id', 'ASC')
->setMaxResults(10)
->getQuery()
->getResult()
;
}
*/

/*
public function findOneBySomeField($value): ?ProductCategory
{
return $this->createQueryBuilder('p')
->andWhere('p.exampleField = :val')
->setParameter('val', $value)
->getQuery()
->getOneOrNullResult()
;
}
*/
}

+ 27
- 0
ShopBundle/Resources/views/backend/order/panel_delivery.html.twig 查看文件

@@ -0,0 +1,27 @@
<div class="row">
<div class="field-group col-12">
<fieldset>
<legend>Livraisons & facturation</legend>
<div class="row">
<div class="col">
{{ form_label(form.deliveryType) }}
{% for field in form.deliveryType %}

{{ form_widget(field, {"attr" : {"v-model" : 'deliveryType'}}) }}
{% endfor %}

</div>
<div class="col" v-if="deliveryType == 'at-home'">
{{ form_row(form.deliveryAddress, {"attr": {'v-model' : 'deliveryAddress'}}) }}
</div>
<div class="col" v-else-if="deliveryType == 'point-sale'">
{{ form_row(form.deliveryPointSale, {"attr": {'v-model' : 'deliveryPointSale'}}) }}
</div>

<div class="col">
{{ form_row(form.invoiceAddress, {"attr": {'v-model' : 'invoiceAddress', 'v-selecttwo' : 'invoiceAddress'}}) }}
</div>
</div>
</fieldset>
</div>
</div>

正在加载...
取消
保存