diff --git a/tests/Assets/Entity/Auth.php b/tests/Assets/Entity/Auth.php index 731fe078..62b09e7d 100644 --- a/tests/Assets/Entity/Auth.php +++ b/tests/Assets/Entity/Auth.php @@ -26,9 +26,11 @@ public function getId(): int|null return $this->id; } - public function setPassword(string $password): void + public function setPassword(string $password): self { - $this->password = (string) $password; + $this->password = $password; + + return $this; } public function getPassword(): string|null @@ -36,9 +38,11 @@ public function getPassword(): string|null return $this->password; } - public function setUsername(string $username): void + public function setUsername(string $username): self { - $this->username = (string) $username; + $this->username = $username; + + return $this; } public function getUsername(): string|null diff --git a/tests/Assets/Entity/Category.php b/tests/Assets/Entity/Category.php index 9fa4e52d..49eb1045 100644 --- a/tests/Assets/Entity/Category.php +++ b/tests/Assets/Entity/Category.php @@ -4,6 +4,7 @@ namespace DoctrineORMModuleTest\Assets\Entity; +use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] @@ -18,6 +19,14 @@ class Category #[ORM\Column(type: 'string', nullable: true)] protected string $name; + #[ORM\ManyToMany(targetEntity: Product::class, mappedBy: 'categories')] + private ArrayCollection $products; + + public function __construct() + { + $this->products = new ArrayCollection(); + } + public function getId(): int|null { return $this->id; diff --git a/tests/Assets/Entity/City.php b/tests/Assets/Entity/City.php index 48342705..1fb8682b 100644 --- a/tests/Assets/Entity/City.php +++ b/tests/Assets/Entity/City.php @@ -18,8 +18,8 @@ class City #[ORM\Column(type: 'string', nullable: true)] protected string $name; - #[ORM\OneToOne(targetEntity: Country::class)] - #[ORM\JoinColumn(name: 'country_id', referencedColumnName: 'id')] + #[ORM\OneToOne(targetEntity: Country::class, inversedBy: 'city')] + #[ORM\JoinColumn(name: 'country_id', referencedColumnName: 'id', unique: true)] protected Country $country; public function getId(): int|null diff --git a/tests/Assets/Entity/Country.php b/tests/Assets/Entity/Country.php index ed3e9be7..45d35b20 100644 --- a/tests/Assets/Entity/Country.php +++ b/tests/Assets/Entity/Country.php @@ -18,6 +18,9 @@ class Country #[ORM\Column(type: 'string', nullable: true)] protected string $name; + #[ORM\OneToOne(targetEntity: City::class, mappedBy: 'country')] + private City $city; + public function getId(): int|null { return $this->id; diff --git a/tests/Assets/Entity/Date.php b/tests/Assets/Entity/Date.php index b53a1378..e0b99f85 100644 --- a/tests/Assets/Entity/Date.php +++ b/tests/Assets/Entity/Date.php @@ -24,9 +24,11 @@ public function getId(): int|null return $this->id; } - public function setDate(DateTime $date): void + public function setDate(DateTime $date): self { $this->date = $date; + + return $this; } public function getDate(): DateTime diff --git a/tests/Assets/Entity/Entity.skipper b/tests/Assets/Entity/Entity.skipper new file mode 100644 index 00000000..f8568fd9 --- /dev/null +++ b/tests/Assets/Entity/Entity.skipper @@ -0,0 +1,263 @@ + + + + + + + + + + + AUTO + + + + + + + doctrine_orm_module_auth + Auth.php + + + + + + + AUTO + + + + + + doctrine_orm_module_date + Date.php + + + + + + + AUTO + + + + + EntityWithoutRepository.php + + + + + + + + + + + + + + + + + + + + + + + + + + + doctrine_orm_module_form_entity + FormEntity.php + + + + + + + + + + + + + + + + + + + + + + + + + + + + AUTO + + + + + FormEntityTarget.php + + + + + + + IDENTITY + + + + + doctrine_orm_module_form_entity_issue237 + Issue237.php + + + + + + + AUTO + + + + + + ResolveTarget.php + + + + + + + + + + + + + + AUTO + + + + + TargetEntity.php + + + + + + + + AUTO + + + + + + + doctrine_orm_module_city + City.php + + + + + + + AUTO + + + + + + doctrine_orm_module_country + Country.php + + + + + + + + + + + + + + + + + + + + + AUTO + + + + + + doctrine_orm_module_category + Category.php + + + + + + + AUTO + + + + + + doctrine_orm_module_product + Product.php + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/Assets/Entity/EntityWithoutRepository.php b/tests/Assets/Entity/EntityWithoutRepository.php index f4ffa0f8..a378230d 100644 --- a/tests/Assets/Entity/EntityWithoutRepository.php +++ b/tests/Assets/Entity/EntityWithoutRepository.php @@ -19,8 +19,10 @@ public function getId(): int|null return $this->id; } - public function setId(int $id): void + public function setId(int $id): self { $this->id = $id; + + return $this; } } diff --git a/tests/Assets/Entity/Product.php b/tests/Assets/Entity/Product.php index b96b3bf1..1a17ac60 100644 --- a/tests/Assets/Entity/Product.php +++ b/tests/Assets/Entity/Product.php @@ -4,6 +4,7 @@ namespace DoctrineORMModuleTest\Assets\Entity; +use Doctrine\Common\Collections\ArrayCollection; use Doctrine\ORM\Mapping as ORM; #[ORM\Entity] @@ -19,8 +20,16 @@ class Product protected string $name; /** @var Category[] */ - #[ORM\ManyToMany(targetEntity: Category::class)] - private array $categories; + #[ORM\ManyToMany(targetEntity: Category::class, inversedBy: 'products')] + #[ORM\JoinTable(name: 'ProductCategory')] + #[ORM\JoinColumn(name: 'Product_id', referencedColumnName: 'id')] + #[ORM\InverseJoinColumn(name: 'Category_id', referencedColumnName: 'id')] + private ArrayCollection $categories; + + public function __construct() + { + $this->categories = new ArrayCollection(); + } public function getId(): int|null { @@ -40,7 +49,7 @@ public function getName(): string } /** @param Category[] $categories */ - public function setCategories(array $categories): self + public function setCategories(ArrayCollection $categories): self { $this->categories = $categories; @@ -48,7 +57,7 @@ public function setCategories(array $categories): self } /** @return Category[] */ - public function getCategories(): array + public function getCategories(): ArrayCollection { return $this->categories; } diff --git a/tests/Assets/Entity/TargetEntity.php b/tests/Assets/Entity/TargetEntity.php index e2c41a51..0cdc8c1f 100644 --- a/tests/Assets/Entity/TargetEntity.php +++ b/tests/Assets/Entity/TargetEntity.php @@ -19,8 +19,10 @@ public function getId(): int return $this->id; } - public function setId(int $id): void + public function setId(int $id): self { $this->id = $id; + + return $this; } }