-
-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
Co-authored-by: Mike Yudin <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Sonata Project package. | ||
* | ||
* (c) Thomas Rabaix <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sonata\EntityAuditBundle\Tests\Fixtures\Relation; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\Common\Collections\Collection; | ||
use Doctrine\DBAL\Types\Types; | ||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
#[ORM\Entity] | ||
class ManyToManyMultipleRelationshipEntity | ||
{ | ||
/** | ||
* @var int|null | ||
*/ | ||
#[ORM\Id] | ||
#[ORM\Column(type: Types::INTEGER)] | ||
#[ORM\GeneratedValue] | ||
protected $id; | ||
|
||
/** | ||
* @var string|null | ||
*/ | ||
#[ORM\Column(type: Types::STRING)] | ||
protected $title; | ||
|
||
/** | ||
* @var Collection<int, ManyToManyMultipleTargetEntity> | ||
*/ | ||
#[ORM\ManyToMany(targetEntity: ManyToManyMultipleTargetEntity::class)] | ||
#[ORM\JoinTable(name: 'many_to_many_primary_target')] | ||
protected $primaryTargets = []; | ||
Check failure on line 43 in tests/Fixtures/Relation/ManyToManyMultipleRelationshipEntity.php GitHub Actions / PHPStan
Check failure on line 43 in tests/Fixtures/Relation/ManyToManyMultipleRelationshipEntity.php GitHub Actions / PsalmInvalidPropertyAssignmentValue
|
||
|
||
/** | ||
* @var Collection<int, ManyToManyMultipleTargetEntity> | ||
*/ | ||
#[ORM\ManyToMany(targetEntity: ManyToManyMultipleTargetEntity::class)] | ||
#[ORM\JoinTable(name: 'many_to_many_secondary_target')] | ||
protected $secondaryTargets; | ||
|
||
public function __construct() | ||
{ | ||
$this->primaryTargets = new ArrayCollection(); | ||
$this->secondaryTargets = new ArrayCollection(); | ||
} | ||
|
||
|
||
public function getId(): ?int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getTitle(): ?string | ||
{ | ||
return $this->title; | ||
} | ||
|
||
public function setTitle(string $title): void | ||
{ | ||
$this->title = $title; | ||
} | ||
|
||
public function getPrimaryTargets(): ArrayCollection|Collection|array | ||
Check failure on line 74 in tests/Fixtures/Relation/ManyToManyMultipleRelationshipEntity.php GitHub Actions / PHPStan
Check failure on line 74 in tests/Fixtures/Relation/ManyToManyMultipleRelationshipEntity.php GitHub Actions / PHPStan
Check failure on line 74 in tests/Fixtures/Relation/ManyToManyMultipleRelationshipEntity.php GitHub Actions / PHPStan
|
||
{ | ||
return $this->primaryTargets; | ||
} | ||
|
||
public function addPrimaryTarget(ManyToManyMultipleTargetEntity $target): void | ||
{ | ||
$this->primaryTargets[] = $target; | ||
} | ||
|
||
public function getSecondaryTargets(): ArrayCollection|Collection | ||
Check failure on line 84 in tests/Fixtures/Relation/ManyToManyMultipleRelationshipEntity.php GitHub Actions / PHPStan
|
||
{ | ||
return $this->secondaryTargets; | ||
} | ||
|
||
public function addSecondaryTarget(ManyToManyMultipleTargetEntity $target): void | ||
{ | ||
$this->secondaryTargets[] = $target; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the Sonata Project package. | ||
* | ||
* (c) Thomas Rabaix <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Sonata\EntityAuditBundle\Tests\Fixtures\Relation; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\Common\Collections\Collection; | ||
use Doctrine\DBAL\Types\Types; | ||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
#[ORM\Entity] | ||
class ManyToManyMultipleTargetEntity | ||
{ | ||
/** | ||
* @var int|null | ||
*/ | ||
#[ORM\Id] | ||
#[ORM\Column(type: Types::INTEGER)] | ||
#[ORM\GeneratedValue] | ||
protected $id; | ||
|
||
|
||
public function getId(): ?int | ||
{ | ||
return $this->id; | ||
} | ||
|
||
} |