Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

UserMerchantFactory.php 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. }