-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deprecate InitializeDefaultEntityCollectionRector, use ExplicitRelati…
…onCollectionRector instead (#304) * cover many to many as well * add annotation test * deprecate InitializeDefaultEntityCollectionRector, use ExplicitRelationCollectionRector instead
- Loading branch information
1 parent
d09e8a0
commit bbc48cc
Showing
6 changed files
with
101 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...Quality/Rector/Class_/ExplicitRelationCollectionRector/Fixture/include_annotation.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Rector\Doctrine\Tests\CodeQuality\Rector\Class_\ExplicitRelationCollectionRector\Fixture; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\ORM\Mapping\Entity; | ||
use Doctrine\ORM\Mapping\ManyToMany; | ||
|
||
/** | ||
* @Entity | ||
*/ | ||
class IncludeAnnotation | ||
{ | ||
/** | ||
* @ManyToMany(targetEntity="SomeClass") | ||
*/ | ||
private $items = []; | ||
public function __construct() | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Doctrine\Tests\CodeQuality\Rector\Class_\ExplicitRelationCollectionRector\Fixture; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\ORM\Mapping\Entity; | ||
use Doctrine\ORM\Mapping\ManyToMany; | ||
|
||
/** | ||
* @Entity | ||
*/ | ||
class IncludeAnnotation | ||
{ | ||
/** | ||
* @ManyToMany(targetEntity="SomeClass") | ||
*/ | ||
private \Doctrine\Common\Collections\Collection $items; | ||
public function __construct() | ||
{ | ||
$this->items = new \Doctrine\Common\Collections\ArrayCollection(); | ||
} | ||
} | ||
|
||
?> |
40 changes: 40 additions & 0 deletions
40
...eQuality/Rector/Class_/ExplicitRelationCollectionRector/Fixture/some_many_to_many.php.inc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace Rector\Doctrine\Tests\CodeQuality\Rector\Class_\ExplicitRelationCollectionRector\Fixture; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\ORM\Mapping\Entity; | ||
use Doctrine\ORM\Mapping\ManyToMany; | ||
|
||
#[Entity] | ||
class SomeManyToMany | ||
{ | ||
#[ManyToMany(targetEntity: 'SomeClass')] | ||
private $items = []; | ||
public function __construct() | ||
{ | ||
} | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Doctrine\Tests\CodeQuality\Rector\Class_\ExplicitRelationCollectionRector\Fixture; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Doctrine\ORM\Mapping\Entity; | ||
use Doctrine\ORM\Mapping\ManyToMany; | ||
|
||
#[Entity] | ||
class SomeManyToMany | ||
{ | ||
#[ManyToMany(targetEntity: 'SomeClass')] | ||
private \Doctrine\Common\Collections\Collection $items; | ||
public function __construct() | ||
{ | ||
$this->items = new \Doctrine\Common\Collections\ArrayCollection(); | ||
} | ||
} | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters