Procházet zdrojové kódy

Ajustement UserMerchantBuilder

develop
Guillaume před 11 měsíci
rodič
revize
5e9add1eb3
1 změnil soubory, kde provedl 7 přidání a 4 odebrání
  1. +7
    -4
      Builder/User/UserMerchantBuilder.php

+ 7
- 4
Builder/User/UserMerchantBuilder.php Zobrazit soubor

@@ -23,7 +23,7 @@ class UserMerchantBuilder
$this->userMerchantStore = $userMerchantStore;
}

public function createIfNotExist(UserInterface $user, MerchantInterface $merchant): UserMerchantInterface
public function createIfNotExist(UserInterface $user, MerchantInterface $merchant, $flush = true): UserMerchantInterface
{
$userMerchant = $this->userMerchantStore
->setMerchant($merchant)
@@ -32,13 +32,16 @@ class UserMerchantBuilder
if (!$userMerchant) {
$userMerchantFactory = new UserMerchantFactory();
$userMerchant = $userMerchantFactory->create($merchant, $user);

$this->entityManager->create($userMerchant);
$this->entityManager->flush();
if($flush) {
$this->entityManager->flush();
}
}elseif(!$userMerchant->getActive()){
$userMerchant->setActive(true);
$this->entityManager->update($userMerchant);
$this->entityManager->flush();
if($flush) {
$this->entityManager->flush();
}
}

return $userMerchant;

Načítá se…
Zrušit
Uložit