use Lc\CaracoleBundle\Container\Config\TaxRateContainer; | use Lc\CaracoleBundle\Container\Config\TaxRateContainer; | ||||
use Lc\CaracoleBundle\Container\Config\UnitContainer; | use Lc\CaracoleBundle\Container\Config\UnitContainer; | ||||
use Lc\CaracoleBundle\Container\Credit\CreditHistoryContainer; | use Lc\CaracoleBundle\Container\Credit\CreditHistoryContainer; | ||||
use Lc\CaracoleBundle\Container\Distribution\DistributionContainer; | |||||
use Lc\CaracoleBundle\Container\File\DocumentContainer; | use Lc\CaracoleBundle\Container\File\DocumentContainer; | ||||
use Lc\CaracoleBundle\Container\Merchant\MerchantContainer; | use Lc\CaracoleBundle\Container\Merchant\MerchantContainer; | ||||
use Lc\CaracoleBundle\Container\Order\OrderPaymentContainer; | use Lc\CaracoleBundle\Container\Order\OrderPaymentContainer; | ||||
use Lc\CaracoleBundle\Container\Product\ProductCategoryContainer; | use Lc\CaracoleBundle\Container\Product\ProductCategoryContainer; | ||||
use Lc\CaracoleBundle\Container\Product\ProductContainer; | use Lc\CaracoleBundle\Container\Product\ProductContainer; | ||||
use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer; | use Lc\CaracoleBundle\Container\Product\ProductFamilyContainer; | ||||
use Lc\CaracoleBundle\Container\Product\ProductFamilySectionPropertyContainer; | |||||
use Lc\CaracoleBundle\Container\Product\QualityLabelContainer; | use Lc\CaracoleBundle\Container\Product\QualityLabelContainer; | ||||
use Lc\CaracoleBundle\Container\Reduction\ReductionCartContainer; | use Lc\CaracoleBundle\Container\Reduction\ReductionCartContainer; | ||||
use Lc\CaracoleBundle\Container\Reduction\ReductionCatalogContainer; | use Lc\CaracoleBundle\Container\Reduction\ReductionCatalogContainer; | ||||
use Lc\CaracoleBundle\Container\User\UserMerchantContainer; | use Lc\CaracoleBundle\Container\User\UserMerchantContainer; | ||||
use Lc\CaracoleBundle\Container\User\UserPointSaleContainer; | use Lc\CaracoleBundle\Container\User\UserPointSaleContainer; | ||||
use Lc\CaracoleBundle\Container\User\VisitorContainer; | 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\Merchant\MerchantInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | ||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | use Lc\CaracoleBundle\Model\Section\SectionInterface; | ||||
public function getOrderShopContainer(): OrderShopContainer | public function getOrderShopContainer(): OrderShopContainer | ||||
{ | { | ||||
return $this->get(OrderShopContainer::class); | return $this->get(OrderShopContainer::class); | ||||
} | } | ||||
]); | ]); | ||||
} | } | ||||
public static function getSubscribedContainerServices(): array | |||||
{ | |||||
$array = []; | |||||
foreach (self::getContainerList() as $container) { | |||||
$array[$container] = $container; | |||||
} | |||||
return $array; | |||||
} | |||||
} | } |
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="addresses") | * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="addresses") | ||||
* @ORM\JoinColumn(nullable=true) | |||||
* @ORM\JoinColumn(nullable=true, onDelete="cascade") | |||||
*/ | */ | ||||
protected $user; | protected $user; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserMerchantInterface", inversedBy="creditHistories") | * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserMerchantInterface", inversedBy="creditHistories") | ||||
* @ORM\JoinColumn(nullable=false) | |||||
* @ORM\JoinColumn(nullable=true, ) | |||||
*/ | */ | ||||
protected $userMerchant; | 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; | 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; | protected $orderRefund; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface") | * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface") | ||||
* @ORM\JoinColumn(nullable=true) | |||||
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL") | |||||
*/ | */ | ||||
protected $buyerAddress; | protected $buyerAddress; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="orderShops", fetch="EAGER") | * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface", inversedBy="orderShops", fetch="EAGER") | ||||
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL") | |||||
*/ | */ | ||||
protected $user; | protected $user; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface") | * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Address\AddressInterface") | ||||
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL") | |||||
*/ | */ | ||||
protected $invoiceAddress; | protected $invoiceAddress; | ||||
protected $idValidOrder; | protected $idValidOrder; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="App\Entity\Address\Address") | * @ORM\ManyToOne(targetEntity="App\Entity\Address\Address") | ||||
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL") | |||||
*/ | */ | ||||
protected $deliveryAddress; | protected $deliveryAddress; | ||||
protected $creditActive = false; | 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; | protected $creditHistories; | ||||
protected $favoriteMerchant; | 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; | protected $addresses; | ||||
protected $userMerchants; | 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; | protected $reductionCredits; | ||||
use Knp\Component\Pager\PaginatorInterface; | use Knp\Component\Pager\PaginatorInterface; | ||||
use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait; | use Lc\CaracoleBundle\Repository\MerchantRepositoryQueryTrait; | ||||
use Lc\SovBundle\Model\User\UserInterface; | |||||
use Lc\SovBundle\Repository\AbstractRepositoryQuery; | use Lc\SovBundle\Repository\AbstractRepositoryQuery; | ||||
class ReductionCartRepositoryQuery extends AbstractRepositoryQuery | class ReductionCartRepositoryQuery extends AbstractRepositoryQuery | ||||
->andWhere('.codes LIKE :code') | ->andWhere('.codes LIKE :code') | ||||
->setParameter('code', '%'.$code.'%') ; | ->setParameter('code', '%'.$code.'%') ; | ||||
} | } | ||||
public function filterByUser(UserInterface $user) | |||||
{ | |||||
return $this | |||||
->andWhere(':user MEMBER OF .users') | |||||
->setParameter('user', $user); | |||||
} | |||||
} | } |
use Lc\CaracoleBundle\Solver\Price\PriceSolver; | use Lc\CaracoleBundle\Solver\Price\PriceSolver; | ||||
use Lc\CaracoleBundle\Solver\Reduction\ReductionCartSolver; | use Lc\CaracoleBundle\Solver\Reduction\ReductionCartSolver; | ||||
use Lc\CaracoleBundle\Repository\AbstractStore; | use Lc\CaracoleBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Model\User\UserInterface; | |||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | use Lc\SovBundle\Repository\RepositoryQueryInterface; | ||||
class ReductionCartStore extends AbstractStore | class ReductionCartStore extends AbstractStore | ||||
protected PriceSolver $priceSolver; | protected PriceSolver $priceSolver; | ||||
public function __construct( | public function __construct( | ||||
ReductionCartRepositoryQuery $query, | |||||
ReductionCartSolver $reductionCartSolver, | |||||
PriceSolver $priceSolver | |||||
) { | |||||
ReductionCartRepositoryQuery $query, | |||||
ReductionCartSolver $reductionCartSolver, | |||||
PriceSolver $priceSolver | |||||
) | |||||
{ | |||||
$this->query = $query; | $this->query = $query; | ||||
$this->reductionCartSolver = $reductionCartSolver; | $this->reductionCartSolver = $reductionCartSolver; | ||||
$this->priceSolver = $priceSolver; | $this->priceSolver = $priceSolver; | ||||
} | } | ||||
return $findReductionCart; | 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(); | |||||
} | |||||
} | } |
} | } | ||||
} | } | ||||
public function filterByUser(UserInterface $user = null) | |||||
{ | |||||
return $this | |||||
->andWhere(':user MEMBER OF .users') | |||||
->setParameter('user', $user); | |||||
} | |||||
public function filterConditionGroupUser(UserInterface $user = null) | public function filterConditionGroupUser(UserInterface $user = null) | ||||
{ | { | ||||
$this->joinGroupUsers(); | $this->joinGroupUsers(); |
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | ||||
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | ||||
use Lc\CaracoleBundle\Repository\AbstractStore; | use Lc\CaracoleBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Model\User\UserInterface; | |||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | use Lc\SovBundle\Repository\RepositoryQueryInterface; | ||||
class ReductionCatalogStore extends AbstractStore | class ReductionCatalogStore extends AbstractStore | ||||
$query->filterProductFamily($productFamily); | $query->filterProductFamily($productFamily); | ||||
return $query->findOne(); | 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(); | |||||
} | |||||
} | } |
namespace Lc\CaracoleBundle\Repository\Reduction; | namespace Lc\CaracoleBundle\Repository\Reduction; | ||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditModel; | |||||
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | use Lc\CaracoleBundle\Repository\MerchantStoreTrait; | ||||
use Lc\CaracoleBundle\Repository\SectionStoreTrait; | use Lc\CaracoleBundle\Repository\SectionStoreTrait; | ||||
use Lc\SovBundle\Model\User\UserInterface; | use Lc\SovBundle\Model\User\UserInterface; | ||||
return $query->find(); | 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(); | |||||
} | |||||
} | } |