Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

42 lines
1.0KB

  1. <?php
  2. namespace Lc\CaracoleBundle\Factory\User;
  3. use Doctrine\ORM\EntityManagerInterface;
  4. use Lc\CaracoleBundle\Model\User\UserMerchantInterface;
  5. use Lc\CaracoleBundle\Resolver\MerchantResolver;
  6. use Lc\SovBundle\Factory\AbstractFactory;
  7. class UserMerchantFactory extends AbstractFactory
  8. {
  9. protected $merchantResolver;
  10. public function __construct(EntityManagerInterface $em, MerchantResolver $merchantResolver)
  11. {
  12. parent::__construct($em);
  13. $this->merchantResolver = $merchantResolver;
  14. }
  15. public function getEntityClass()
  16. {
  17. return UserMerchantInterface::class;
  18. }
  19. public function create($params = array())
  20. {
  21. if(!isset($params['merchant'])){
  22. $params['merchant'] = $this->merchantResolver->getCurrent();
  23. }
  24. if(!isset($params['creditActive'])){
  25. $params['creditActive'] =false;
  26. }
  27. if(!isset($params['active'])){
  28. $params['active'] = true;
  29. }
  30. return parent::create($params); // TODO: Change the autogenerated stub
  31. }
  32. }