Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?php

declare(strict_types=1);

namespace Page;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Table(name="page_template")
* @ORM\Entity()
*/
class Template
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;

/**
* @var Area[]|ArrayCollection
*
* @ORM\ManyToMany(targetEntity="Area", cascade={"remove", "persist"}, inversedBy="templates")
* @ORM\JoinTable(name="page_template_area",
* joinColumns={@ORM\JoinColumn(name="template_id", referencedColumnName="id", onDelete="CASCADE")},
* inverseJoinColumns={@ORM\JoinColumn(name="area_id", referencedColumnName="id")}
* )
*/
private $areas;

public function __construct()
{
$this->areas = new ArrayCollection();
}

public function getId(): ?int
{
return $this->id;
}

public function addArea(Area $area): self
{
$this->areas[] = $area;

return $this;
}

public function removeArea(Area $area): self
{
$this->areas->removeElement($area);

return $this;
}

/**
* @return Area[]|ArrayCollection
*/
public function getAreas()
{
return $this->areas;
}
}

/**
* @ORM\Table(name="Area",indexes={@ORM\Index(name="area_name_idx", columns={"name"})})
* @ORM\Entity()
*/
class Area
{
/**
* @var Template[]|ArrayCollection
*
* @ORM\ManyToMany(targetEntity="Template", mappedBy="areas")
*/
private $templates;

public function __construct()
{
$this->templates = new ArrayCollection();
}

public function addTemplate(Template $template): self
{
$this->templates[] = $template;

return $this;
}

public function removeTemplate(Template $template): self
{
$this->templates->removeElement($template);

return $this;
}

/**
* @return Template[]|ArrayCollection
*/
public function getTemplates()
{
return $this->templates;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public function provideNamespacedClasses(): Iterator
yield [__DIR__ . '/Fixture/keep_various_request.php.inc'];
yield [__DIR__ . '/Fixture/instance_of.php.inc'];
yield [__DIR__ . '/Fixture/should_keep_all_doc_blocks_annotations_parameters.php.inc'];
yield [__DIR__ . '/Fixture/should_not_break_doctrine_inverse_join_columns_annotations.php.inc'];

yield [__DIR__ . '/Fixture/import_root_namespace_classes_enabled.php.inc'];
}
Expand Down