@@ -6,7 +6,6 @@ use Lc\CaracoleBundle\Container\Address\AddressContainer; | |||
use Lc\CaracoleBundle\Container\Config\TaxRateContainer; | |||
use Lc\CaracoleBundle\Container\Config\UnitContainer; | |||
use Lc\CaracoleBundle\Container\Credit\CreditHistoryContainer; | |||
use Lc\CaracoleBundle\Container\Distribution\DistributionContainer; | |||
use Lc\CaracoleBundle\Container\File\DocumentContainer; | |||
use Lc\CaracoleBundle\Container\Merchant\MerchantContainer; | |||
use Lc\CaracoleBundle\Container\Order\OrderPaymentContainer; | |||
@@ -24,7 +23,6 @@ use Lc\CaracoleBundle\Container\PointSale\PointSaleSectionContainer; | |||
use Lc\CaracoleBundle\Container\Product\ProductCategoryContainer; | |||
use Lc\CaracoleBundle\Container\Product\ProductContainer; | |||
use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer; | |||
use Lc\CaracoleBundle\Container\Product\ProductFamilySectionPropertyContainer; | |||
use Lc\CaracoleBundle\Container\Product\QualityLabelContainer; | |||
use Lc\CaracoleBundle\Container\Reduction\ReductionCartContainer; | |||
use Lc\CaracoleBundle\Container\Reduction\ReductionCatalogContainer; | |||
@@ -36,7 +34,7 @@ use Lc\CaracoleBundle\Container\Setting\SectionSettingContainer; | |||
use Lc\CaracoleBundle\Container\User\UserMerchantContainer; | |||
use Lc\CaracoleBundle\Container\User\UserPointSaleContainer; | |||
use Lc\CaracoleBundle\Container\User\VisitorContainer; | |||
use Lc\SovBundle\Definition\ApplicationDefinition; | |||
use Lc\CaracoleBundle\Definition\ApplicationDefinition; | |||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | |||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||
@@ -171,7 +169,6 @@ trait ControllerTrait | |||
public function getOrderShopContainer(): OrderShopContainer | |||
{ | |||
return $this->get(OrderShopContainer::class); | |||
} | |||
@@ -81,15 +81,4 @@ class ApplicationDefinition extends SovAbstractApplicationDefinition | |||
]); | |||
} | |||
public static function getSubscribedContainerServices(): array | |||
{ | |||
$array = []; | |||
foreach (self::getContainerList() as $container) { | |||
$array[$container] = $container; | |||
} | |||
return $array; | |||
} | |||
} |
@@ -22,7 +22,7 @@ abstract class AddressModel extends AbstractLightEntity implements StatusInterfa | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="addresses") | |||
* @ORM\JoinColumn(nullable=true) | |||
* @ORM\JoinColumn(nullable=true, onDelete="cascade") | |||
*/ | |||
protected $user; | |||
@@ -34,17 +34,17 @@ abstract class CreditHistoryModel extends AbstractLightEntity implements PayoffI | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserMerchantInterface", inversedBy="creditHistories") | |||
* @ORM\JoinColumn(nullable=false) | |||
* @ORM\JoinColumn(nullable=true, ) | |||
*/ | |||
protected $userMerchant; | |||
/** | |||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderPaymentInterface", cascade={"persist", "remove"}) | |||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderPaymentInterface", cascade={"persist"}) | |||
*/ | |||
protected $orderPayment; | |||
/** | |||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderRefundInterface", cascade={"persist", "remove"}) | |||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderRefundInterface", cascade={"persist"}) | |||
*/ | |||
protected $orderRefund; | |||
@@ -51,7 +51,7 @@ abstract class DocumentModel extends AbstractFullEntity implements FilterMerchan | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface") | |||
* @ORM\JoinColumn(nullable=true) | |||
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL") | |||
*/ | |||
protected $buyerAddress; | |||
@@ -25,6 +25,7 @@ abstract class OrderShopModel extends AbstractLightEntity implements FilterSecti | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="orderShops", fetch="EAGER") | |||
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL") | |||
*/ | |||
protected $user; | |||
@@ -35,6 +36,7 @@ abstract class OrderShopModel extends AbstractLightEntity implements FilterSecti | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface") | |||
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL") | |||
*/ | |||
protected $invoiceAddress; | |||
@@ -132,6 +134,7 @@ abstract class OrderShopModel extends AbstractLightEntity implements FilterSecti | |||
protected $idValidOrder; | |||
/** | |||
* @ORM\ManyToOne(targetEntity="App\Entity\Address\Address") | |||
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL") | |||
*/ | |||
protected $deliveryAddress; | |||
@@ -45,7 +45,7 @@ abstract class UserMerchantModel implements FilterMerchantInterface, EntityInter | |||
protected $creditActive = false; | |||
/** | |||
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface", mappedBy="userMerchant", orphanRemoval=true) | |||
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface", mappedBy="userMerchant", cascade={"remove"}) | |||
*/ | |||
protected $creditHistories; | |||
@@ -35,7 +35,7 @@ abstract class UserModel extends SovUserModel | |||
protected $favoriteMerchant; | |||
/** | |||
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface", mappedBy="user", cascade={"persist"}) | |||
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface", mappedBy="user", cascade={"persist", "remove"}) | |||
*/ | |||
protected $addresses; | |||
@@ -65,7 +65,7 @@ abstract class UserModel extends SovUserModel | |||
protected $userMerchants; | |||
/** | |||
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface", mappedBy="users") | |||
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface", mappedBy="users", orphanRemoval=true) | |||
*/ | |||
protected $reductionCredits; | |||
@@ -4,6 +4,7 @@ namespace Lc\CaracoleBundle\Repository\Reduction; | |||
use Knp\Component\Pager\PaginatorInterface; | |||
use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait; | |||
use Lc\SovBundle\Model\User\UserInterface; | |||
use Lc\SovBundle\Repository\AbstractRepositoryQuery; | |||
class ReductionCartRepositoryQuery extends AbstractRepositoryQuery | |||
@@ -21,4 +22,11 @@ class ReductionCartRepositoryQuery extends AbstractRepositoryQuery | |||
->andWhere('.codes LIKE :code') | |||
->setParameter('code', '%'.$code.'%') ; | |||
} | |||
public function filterByUser(UserInterface $user) | |||
{ | |||
return $this | |||
->andWhere(':user MEMBER OF .users') | |||
->setParameter('user', $user); | |||
} | |||
} |
@@ -6,6 +6,7 @@ use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | |||
use Lc\CaracoleBundle\Solver\Price\PriceSolver; | |||
use Lc\CaracoleBundle\Solver\Reduction\ReductionCartSolver; | |||
use Lc\CaracoleBundle\Repository\AbstractStore; | |||
use Lc\SovBundle\Model\User\UserInterface; | |||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||
class ReductionCartStore extends AbstractStore | |||
@@ -17,10 +18,11 @@ class ReductionCartStore extends AbstractStore | |||
protected PriceSolver $priceSolver; | |||
public function __construct( | |||
ReductionCartRepositoryQuery $query, | |||
ReductionCartSolver $reductionCartSolver, | |||
PriceSolver $priceSolver | |||
) { | |||
ReductionCartRepositoryQuery $query, | |||
ReductionCartSolver $reductionCartSolver, | |||
PriceSolver $priceSolver | |||
) | |||
{ | |||
$this->query = $query; | |||
$this->reductionCartSolver = $reductionCartSolver; | |||
$this->priceSolver = $priceSolver; | |||
@@ -60,4 +62,13 @@ class ReductionCartStore extends AbstractStore | |||
} | |||
return $findReductionCart; | |||
} | |||
//Toutes les reductionCart d'un utilisateur inter/merchant | |||
public function getByUserOutOfContext(UserInterface $user, $query = null) | |||
{ | |||
$query = $this->createQuery($query); | |||
$query->filterIsOnlineAndOffline(); | |||
$query->filterByUser($user); | |||
return $query->find(); | |||
} | |||
} |
@@ -114,6 +114,14 @@ class ReductionCatalogRepositoryQuery extends AbstractRepositoryQuery | |||
} | |||
} | |||
public function filterByUser(UserInterface $user = null) | |||
{ | |||
return $this | |||
->andWhere(':user MEMBER OF .users') | |||
->setParameter('user', $user); | |||
} | |||
public function filterConditionGroupUser(UserInterface $user = null) | |||
{ | |||
$this->joinGroupUsers(); |
@@ -5,6 +5,7 @@ namespace Lc\CaracoleBundle\Repository\Reduction; | |||
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | |||
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | |||
use Lc\CaracoleBundle\Repository\AbstractStore; | |||
use Lc\SovBundle\Model\User\UserInterface; | |||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | |||
class ReductionCatalogStore extends AbstractStore | |||
@@ -42,4 +43,14 @@ class ReductionCatalogStore extends AbstractStore | |||
$query->filterProductFamily($productFamily); | |||
return $query->findOne(); | |||
} | |||
//Toutes les reductionCatalog d'un utilisateur inter/merchant | |||
public function getByUserOutOfContext(UserInterface $user, $query = null) | |||
{ | |||
$query = $this->createQuery($query); | |||
$query->filterIsOnlineAndOffline(); | |||
$query->filterByUser($user); | |||
return $query->find(); | |||
} | |||
} |
@@ -2,6 +2,7 @@ | |||
namespace Lc\CaracoleBundle\Repository\Reduction; | |||
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditModel; | |||
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | |||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | |||
use Lc\SovBundle\Model\User\UserInterface; | |||
@@ -83,4 +84,24 @@ class ReductionCreditStore extends AbstractStore | |||
return $query->find(); | |||
} | |||
//Toutes les reductionGift d'un utilisateur inter/merchant | |||
public function getReductionGiftByUserOutOfContext(UserInterface $user, $query = null) | |||
{ | |||
$query = $this->createQuery($query); | |||
$query->filterIsOnlineAndOffline(); | |||
$query->filterByUser($user); | |||
$query->filterByType(ReductionCreditModel::TYPE_GIFT); | |||
return $query->find(); | |||
} | |||
//Toutes les reductionCredit d'un utilisateur inter/merchant | |||
public function getReductionCreditByUserOutOfContext(UserInterface $user, $query = null) | |||
{ | |||
$query = $this->createQuery($query); | |||
$query->filterIsOnlineAndOffline(); | |||
$query->filterByUser($user); | |||
$query->filterByType(ReductionCreditModel::TYPE_CREDIT); | |||
return $query->find(); | |||
} | |||
} |