Skip to content

[Doctrine] Add AlwaysInitializeUuidInEntityRector#1994

Merged
TomasVotruba merged 1 commit intomasterfrom
uuid-add
Sep 18, 2019
Merged

[Doctrine] Add AlwaysInitializeUuidInEntityRector#1994
TomasVotruba merged 1 commit intomasterfrom
uuid-add

Conversation

@TomasVotruba
Copy link
Copy Markdown
Member

@TomasVotruba TomasVotruba commented Sep 18, 2019

 /**
  * @ORM\Id
  * @var UuidInterface
  */
 private $id;

+public function __construct()
+{
+    $this->id = \Ramsey\Uuid\Uuid::uuid4();
+}

@TomasVotruba
Copy link
Copy Markdown
Member Author

@JanMikes The simple rule to add uuid init every entity is done 👍

@TomasVotruba TomasVotruba merged commit 60073f3 into master Sep 18, 2019
@TomasVotruba TomasVotruba deleted the uuid-add branch September 18, 2019 07:34
@JanMikes
Copy link
Copy Markdown
Contributor

👏

Just curious, i did not check implementation yet, how does it detect to which property it should add?

@TomasVotruba
Copy link
Copy Markdown
Member Author

TomasVotruba commented Sep 18, 2019

Basically this:

/**
 * @ORM\Id
 * @var UuidInterface
 */
private $anyName;

TomasVotruba added a commit that referenced this pull request Apr 2, 2022
rectorphp/rector-src@3b40197 [CodeQuality] Skip parent::class usage on GetClassToInstanceOfRector (#1994)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants