*/ | */ | ||||
protected $news; | protected $news; | ||||
/** | |||||
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\PageInterface", mappedBy="merchant", orphanRemoval=true) | |||||
*/ | |||||
protected $pages; | |||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\NewsletterInterface", mappedBy="merchant") | * @ORM\OneToMany(targetEntity="Lc\ShopBundle\Context\NewsletterInterface", mappedBy="merchant") | ||||
*/ | */ | ||||
return $this; | return $this; | ||||
} | } | ||||
/** | |||||
* @return Collection|Page[] | |||||
*/ | |||||
public function getPages(): Collection | |||||
{ | |||||
return $this->pages; | |||||
} | |||||
public function addPage(Page $page): self | |||||
{ | |||||
if (!$this->pages->contains($page)) { | |||||
$this->pages[] = $page; | |||||
$page->setMerchant($this); | |||||
} | |||||
return $this; | |||||
} | |||||
public function removePage(Page $page): self | |||||
{ | |||||
if ($this->pages->contains($page)) { | |||||
$this->pages->removeElement($page); | |||||
// set the owning side to null (unless already changed) | |||||
if ($page->getMerchant() === $this) { | |||||
$page->setMerchant(null); | |||||
} | |||||
} | |||||
return $this; | |||||
} | |||||
/** | /** | ||||
* @return Collection|Newsletter[] | * @return Collection|Newsletter[] | ||||
*/ | */ |
namespace Lc\ShopBundle\Model; | namespace Lc\ShopBundle\Model; | ||||
use App\Entity\Hub; | |||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use Lc\ShopBundle\Context\FilterMerchantInterface; | |||||
/** | /** | ||||
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() | ||||
*/ | */ | ||||
abstract class Page extends AbstractDocumentEntity | |||||
abstract class Page extends AbstractDocumentEntity implements FilterMerchantInterface | |||||
{ | { | ||||
/** | /** | ||||
* @ORM\Column(type="text", nullable=true) | * @ORM\Column(type="text", nullable=true) | ||||
*/ | */ | ||||
protected $content; | protected $content; | ||||
/** | |||||
* @ORM\ManyToOne(targetEntity="Lc\ShopBundle\Context\MerchantInterface", inversedBy="pages") | |||||
* @ORM\JoinColumn(nullable=false) | |||||
*/ | |||||
protected $merchant; | |||||
public function __toString() | public function __toString() | ||||
{ | { | ||||
return $this->getTitle() ; | return $this->getTitle() ; | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getMerchant(): ?Hub | |||||
{ | |||||
return $this->merchant; | |||||
} | |||||
public function setMerchant(?Hub $merchant): self | |||||
{ | |||||
$this->merchant = $merchant; | |||||
return $this; | |||||
} | |||||
} | } |