Skip to content

Commit

Permalink
NTR - Replaced Uuid Generator with doctrines
Browse files Browse the repository at this point in the history
  • Loading branch information
cyl3x committed Oct 7, 2024
1 parent 6e89b09 commit 098fa8b
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 135 deletions.
30 changes: 0 additions & 30 deletions src/Doctrine/RespectfulUuidGenerator.php

This file was deleted.

9 changes: 4 additions & 5 deletions src/Entity/Contract/EntityIdTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Swag\Braintree\Entity\Contract;

use Doctrine\ORM\Mapping as ORM;
use Swag\Braintree\Doctrine\RespectfulUuidGenerator;
use Symfony\Component\Uid\Uuid;

#[ORM\MappedSuperclass]
Expand All @@ -12,17 +11,17 @@ trait EntityIdTrait
#[ORM\Id]
#[ORM\Column(type: 'uuid', unique: true)]
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
#[ORM\CustomIdGenerator(class: RespectfulUuidGenerator::class)]
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
// will never be null in the database
// null only signalizes the uuid-generator to generate a new uuid for the database
private ?Uuid $id = null;
private Uuid $id;

public function getId(): ?Uuid
{
return $this->id;
return $this->id ?? null;
}

public function setId(?Uuid $id): self
public function setId(Uuid $id): self
{
$this->id = $id;

Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Contract/EntityInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface EntityInterface
{
public function getId(): ?Uuid;

public function setId(?Uuid $id): self;
public function setId(Uuid $id): self;

public function getCreatedAt(): \DateTimeInterface;

Expand Down
99 changes: 0 additions & 99 deletions tests/unit/Doctrine/RespectfulUuidGeneratorTest.php

This file was deleted.

0 comments on commit 098fa8b

Please sign in to comment.