You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 line
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. }