-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Php80] Skip change UniqueEntity constrainst annotation if Entity att…
…ribute exists on AnnotationToAttributeRector (#747) * [Php80] Do not change UniqueEntity constrainst annotation if Entity attribute exists * skip * update fixture * update fixture different definition for uniqueentity * Fixed 🎉 * doc regex * rename fixture * add more fixture for do not change unique entity when enitty attribute not exists
- Loading branch information
1 parent
006ed85
commit 9443e84
Showing
4 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
.../FixtureAutoImported/do_not_change_unique_entity_when_entity_attribute_not_exists.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,39 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\FixtureAutoImported; | ||
|
||
use Doctrine\ORM\Mapping\Entity; | ||
use Doctrine\ORM\Mapping\Table; | ||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; | ||
|
||
/** | ||
* @UniqueEntity(fields={"username"}) | ||
* @UniqueEntity("email") | ||
* @Entity(repositoryClass=UserRepository::class) | ||
*/ | ||
#[Table(name: 'users')] | ||
class User | ||
{ | ||
} | ||
|
||
?> | ||
----- | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\FixtureAutoImported; | ||
|
||
use Doctrine\ORM\Mapping\Entity; | ||
use Doctrine\ORM\Mapping\Table; | ||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; | ||
|
||
/** | ||
* @UniqueEntity(fields={"username"}) | ||
* @UniqueEntity("email") | ||
*/ | ||
#[Table(name: 'users')] | ||
#[Entity(repositoryClass: UserRepository::class)] | ||
class User | ||
{ | ||
} | ||
|
||
?> |
19 changes: 19 additions & 0 deletions
19
...tributeRector/FixtureAutoImported/skip_unique_entity_when_entity_attribute_exists.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,19 @@ | ||
<?php | ||
|
||
namespace Rector\Tests\Php80\Rector\Class_\AnnotationToAttributeRector\FixtureAutoImported; | ||
|
||
use Doctrine\ORM\Mapping\Entity; | ||
use Doctrine\ORM\Mapping\Table; | ||
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity; | ||
|
||
/** | ||
* @UniqueEntity(fields={"username"}) | ||
* @UniqueEntity("email") | ||
*/ | ||
#[Entity(repositoryClass: 'UserRepository')] | ||
#[Table(name: 'users')] | ||
class User | ||
{ | ||
} | ||
|
||
?> |
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