@@ -0,0 +1,13 @@ | |||
<?php | |||
namespace Lc\CaracoleBundle\Controller\Newsletter; | |||
use Lc\CaracoleBundle\Controller\AdminControllerTrait; | |||
use Lc\SovBundle\Controller\Newsletter\NewsletterAdminController as SovNewsletterAdminController; | |||
abstract class NewsletterAdminController extends SovNewsletterAdminController | |||
{ | |||
use AdminControllerTrait; | |||
} |
@@ -8,7 +8,7 @@ use Doctrine\ORM\Mapping as ORM; | |||
use Lc\CaracoleBundle\Model\Address\AddressInterface; | |||
use Lc\CaracoleBundle\Model\Config\TaxRateInterface; | |||
use Lc\CaracoleBundle\Model\Credit\CreditConfigInterface; | |||
use Lc\CaracoleBundle\Model\Newsletter\NewsletterInterface; | |||
use Lc\SovBundle\Model\Newsletter\NewsletterInterface; | |||
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | |||
use Lc\CaracoleBundle\Model\Product\ProductCategoryInterface; | |||
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | |||
@@ -71,7 +71,7 @@ abstract class MerchantModel extends AbstractFullEntity | |||
protected $pages; | |||
/** | |||
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Newsletter\NewsletterInterface", mappedBy="merchant") | |||
* @ORM\OneToMany(targetEntity="Lc\SovBundle\Model\Newsletter\NewsletterInterface", mappedBy="merchant") | |||
*/ | |||
protected $newsletters; | |||
@@ -1,8 +0,0 @@ | |||
<?php | |||
namespace Lc\CaracoleBundle\Model\Newsletter ; | |||
interface NewsletterInterface | |||
{ | |||
} |
@@ -3,42 +3,20 @@ | |||
namespace Lc\CaracoleBundle\Model\Newsletter; | |||
use Doctrine\ORM\Mapping as ORM; | |||
use Doctrine\Common\Collections\ArrayCollection; | |||
use Doctrine\Common\Collections\Collection; | |||
use Lc\CaracoleBundle\Doctrine\Extension\FilterMerchantInterface; | |||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||
use Lc\SovBundle\Doctrine\Pattern\AbstractFullEntity; | |||
use Lc\SovBundle\Model\User\UserInterface; | |||
use Lc\SovBundle\Model\Newsletter\NewsletterModel as SovNewsletterModel; | |||
/** | |||
* @ORM\MappedSuperclass() | |||
*/ | |||
abstract class NewsletterModel extends AbstractFullEntity implements FilterMerchantInterface | |||
abstract class NewsletterModel extends SovNewsletterModel implements FilterMerchantInterface | |||
{ | |||
/** | |||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", inversedBy="newsletters") | |||
*/ | |||
protected $merchant; | |||
/** | |||
* @ORM\ManyToMany(targetEntity="Lc\SovBundle\Model\User\UserInterface", mappedBy="newsletters") | |||
*/ | |||
protected $users; | |||
/** | |||
* @ORM\Column(type="boolean", nullable=true) | |||
*/ | |||
protected $isMain; | |||
public function __toString() | |||
{ | |||
return $this->getTitle(); | |||
} | |||
public function __construct() | |||
{ | |||
$this->users = new ArrayCollection(); | |||
} | |||
public function getMerchant(): ?MerchantInterface | |||
{ | |||
@@ -51,44 +29,4 @@ abstract class NewsletterModel extends AbstractFullEntity implements FilterMerch | |||
return $this; | |||
} | |||
/** | |||
* @return Collection|UserInterface[] | |||
*/ | |||
public function getUsers(): Collection | |||
{ | |||
return $this->users; | |||
} | |||
public function addUser(UserInterface $user): self | |||
{ | |||
if (!$this->users->contains($user)) { | |||
$this->users[] = $user; | |||
$user->addNewsletter($this); | |||
} | |||
return $this; | |||
} | |||
public function removeUser(UserInterface $user): self | |||
{ | |||
if ($this->users->contains($user)) { | |||
$this->users->removeElement($user); | |||
$user->removeNewsletter($this); | |||
} | |||
return $this; | |||
} | |||
public function getIsMain(): ?bool | |||
{ | |||
return $this->isMain; | |||
} | |||
public function setIsMain(?bool $isMain): self | |||
{ | |||
$this->isMain = $isMain; | |||
return $this; | |||
} | |||
} |
@@ -7,7 +7,7 @@ use Doctrine\Common\Collections\Collection; | |||
use Doctrine\ORM\Mapping as ORM; | |||
use Gedmo\Mapping\Annotation as Gedmo; | |||
use Lc\CaracoleBundle\Model\Address\AddressInterface; | |||
use Lc\CaracoleBundle\Model\Newsletter\NewsletterInterface; | |||
use Lc\SovBundle\Model\Newsletter\NewsletterInterface; | |||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | |||
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | |||
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; | |||
@@ -62,7 +62,7 @@ abstract class UserModel extends SovUserModel | |||
protected $gender; | |||
/** | |||
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Newsletter\NewsletterInterface", inversedBy="users") | |||
* @ORM\ManyToMany(targetEntity="Lc\SovBundle\Model\Newsletter\NewsletterInterface", inversedBy="users") | |||
*/ | |||
protected $newsletters; | |||
@@ -1,21 +0,0 @@ | |||
<?php | |||
namespace Lc\CaracoleBundle\Repository\Newsletter; | |||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; | |||
use Doctrine\Persistence\ManagerRegistry; | |||
use Lc\CaracoleBundle\Model\Newsletter\NewsletterInterface; | |||
/** | |||
* @method NewsletterInterface|null find($id, $lockMode = null, $lockVersion = null) | |||
* @method NewsletterInterface|null findOneBy(array $criteria, array $orderBy = null) | |||
* @method NewsletterInterface[] findAll() | |||
* @method NewsletterInterface[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null) | |||
*/ | |||
class NewsletterRepository extends ServiceEntityRepository | |||
{ | |||
public function __construct(ManagerRegistry $registry) | |||
{ | |||
parent::__construct($registry, NewsletterInterface::class); | |||
} | |||
} |