|
- <?php
-
- namespace Lc\CaracoleBundle\Factory\User;
-
- use Lc\CaracoleBundle\Container\User\UserMerchantContainer;
- use Lc\CaracoleBundle\Model\Merchant\MerchantInterface;
- use Lc\CaracoleBundle\Model\User\UserMerchantInterface;
- use Lc\SovBundle\Factory\AbstractFactory;
- use Lc\SovBundle\Model\User\UserInterface;
-
- class UserMerchantFactory extends AbstractFactory
- {
- public function createBase(MerchantInterface $merchant): UserMerchantInterface
- {
- $class = UserMerchantContainer::getEntityFqcn();
- $userMerchant = new $class;
- $userMerchant->setMerchant($merchant);
-
- return $userMerchant;
- }
-
- // createUserMerchant
- public function create(MerchantInterface $merchant, UserInterface $user = null): UserMerchantInterface
- {
- $userMerchant = $this->createBase($merchant);
- $userMerchant->setUser($user);
-
- return $userMerchant;
- }
- }
|