浏览代码

Correctif position catégories

feature/export_comptable
Guillaume 4 年前
父节点
当前提交
b262870239
共有 1 个文件被更改,包括 13 次插入7 次删除
  1. +13
    -7
      ShopBundle/EventSubscriber/EditEventSubscriber.php

+ 13
- 7
ShopBundle/EventSubscriber/EditEventSubscriber.php 查看文件

@@ -67,12 +67,14 @@ class EditEventSubscriber implements EventSubscriberInterface
return $entity;
}

private function setSortableProperty($entity, $entityRepo){
private function setSortableProperty($entity, $entityRepo)
{
if ($entity instanceof TreeInterface) {
if ($entity->getParent()) {
$total = $entityRepo->count(array('status' => 1, 'parent' => $entity->getParent()->getId()));
$entity->setPosition($entity->getParent()->getId() . '_' . $total);
} else {
$entity->setPosition((float) $entity->getParent()->getId() . '.' . str_pad($total, 2, '0', STR_PAD_LEFT));
}
else {
if ($entity instanceof FilterMerchantInterface) {
$total = $entityRepo->count(array('status' => 1, 'parent' => null, 'merchant' => $this->merchantUtils->getMerchantCurrent()));
}else{
@@ -80,10 +82,12 @@ class EditEventSubscriber implements EventSubscriberInterface
}
$entity->setPosition($total);
}
} else {
}
else {
if ($entity instanceof FilterMerchantInterface) {
$total = $entityRepo->count(array('status' => 1, 'merchant' => $this->merchantUtils->getMerchantCurrent()));
}else{
}
else {
$total = $entityRepo->count(array('status' => 1));
}
$entity->setPosition($total);
@@ -91,11 +95,13 @@ class EditEventSubscriber implements EventSubscriberInterface
return $entity;
}

private function setMerchantProperty($entity){
private function setMerchantProperty($entity)
{
$entity->setMerchant($this->merchantUtils->getMerchantCurrent());
}

private function setMultipleMerchantProperty($entity){
private function setMultipleMerchantProperty($entity)
{
if ($entity->getMerchants()->isEmpty()) {
$entity->addMerchant($this->merchantUtils->getMerchantCurrent());
}

正在加载...
取消
保存