|
- <?php
-
- namespace Lc\CaracoleBundle\Factory\User;
-
- use App\Entity\User\UserMerchant;
- use Lc\CaracoleBundle\Context\MerchantContextTrait;
- 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
- {
- $userMerchant = new UserMerchant();
- $userMerchant->setMerchant($merchant);
-
- return $userMerchant;
- }
-
- // createUserMerchant
- public function create(MerchantInterface $merchant, UserInterface $user = null): UserMerchantInterface
- {
- $userMerchant = $this->createBase($merchant);
- $userMerchant->setUser($user);
-
- return $userMerchant;
- }
- }
|