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.

33 lines
960B

  1. <?php
  2. namespace Lc\CaracoleBundle\Factory\Credit;
  3. use Lc\CaracoleBundle\Container\Credit\CreditHistoryContainer;
  4. use Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface;
  5. use Lc\CaracoleBundle\Model\User\UserMerchantInterface;
  6. use Lc\SovBundle\Factory\AbstractFactory;
  7. class CreditHistoryFactory extends AbstractFactory
  8. {
  9. // createCreditHistory
  10. public function create(string $type,UserMerchantInterface $userMerchant ): CreditHistoryInterface
  11. {
  12. $creditHistory = $this->createBase($userMerchant);
  13. $creditHistory->setType($type) ;
  14. return $creditHistory;
  15. }
  16. public function createBase(UserMerchantInterface $userMerchant): CreditHistoryInterface
  17. {
  18. $class = CreditHistoryContainer::getEntityFqcn();
  19. $creditHistory = new $class;
  20. $creditHistory->setUserMerchant($userMerchant) ;
  21. $creditHistory->setMerchant($userMerchant->getMerchant()) ;
  22. return $creditHistory;
  23. }
  24. }