|
|
@@ -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()); |
|
|
|
} |