Browse Source

Suppression user

packProduct
Fabien Normand 2 years ago
parent
commit
d628aaee30
13 changed files with 75 additions and 27 deletions
  1. +1
    -4
      Controller/ControllerTrait.php
  2. +0
    -11
      Definition/ApplicationDefinition.php
  3. +1
    -1
      Model/Address/AddressModel.php
  4. +3
    -3
      Model/Credit/CreditHistoryModel.php
  5. +1
    -1
      Model/File/DocumentModel.php
  6. +3
    -0
      Model/Order/OrderShopModel.php
  7. +1
    -1
      Model/User/UserMerchantModel.php
  8. +2
    -2
      Model/User/UserModel.php
  9. +8
    -0
      Repository/Reduction/ReductionCartRepositoryQuery.php
  10. +15
    -4
      Repository/Reduction/ReductionCartStore.php
  11. +8
    -0
      Repository/Reduction/ReductionCatalogRepositoryQuery.php
  12. +11
    -0
      Repository/Reduction/ReductionCatalogStore.php
  13. +21
    -0
      Repository/Reduction/ReductionCreditStore.php

+ 1
- 4
Controller/ControllerTrait.php View File

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



+ 0
- 11
Definition/ApplicationDefinition.php View File

]); ]);
} }


public static function getSubscribedContainerServices(): array
{

$array = [];

foreach (self::getContainerList() as $container) {
$array[$container] = $container;
}

return $array;
}
} }

+ 1
- 1
Model/Address/AddressModel.php View File



/** /**
* @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;



+ 3
- 3
Model/Credit/CreditHistoryModel.php View File



/** /**
* @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;



+ 1
- 1
Model/File/DocumentModel.php View File



/** /**
* @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;



+ 3
- 0
Model/Order/OrderShopModel.php View File



/** /**
* @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;



+ 1
- 1
Model/User/UserMerchantModel.php View File

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;



+ 2
- 2
Model/User/UserModel.php View File

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;



+ 8
- 0
Repository/Reduction/ReductionCartRepositoryQuery.php View File



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

+ 15
- 4
Repository/Reduction/ReductionCartStore.php View File

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

+ 8
- 0
Repository/Reduction/ReductionCatalogRepositoryQuery.php View File

} }
} }


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

+ 11
- 0
Repository/Reduction/ReductionCatalogStore.php View File

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

+ 21
- 0
Repository/Reduction/ReductionCreditStore.php View File



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

} }

Loading…
Cancel
Save