57 lines
1.3 KiB
PHP
57 lines
1.3 KiB
PHP
<?php
|
|
|
|
use Symfony\Bundle\MakerBundle\Maker\Common\EntityIdTypeEnum;
|
|
|
|
?>
|
|
<?= "<?php\n" ?>
|
|
|
|
namespace <?= $namespace ?>;
|
|
|
|
<?= $use_statements; ?>
|
|
|
|
#[ORM\Entity(repositoryClass: <?= $repository_class_name ?>::class)]
|
|
<?php if ($should_escape_table_name): ?>#[ORM\Table(name: '`<?= $table_name ?>`')]
|
|
<?php endif ?>
|
|
<?php if ($api_resource): ?>
|
|
#[ApiResource]
|
|
<?php endif ?>
|
|
<?php if ($broadcast): ?>
|
|
#[Broadcast]
|
|
<?php endif ?>
|
|
class <?= $class_name."\n" ?>
|
|
{
|
|
<?php if (EntityIdTypeEnum::UUID === $id_type): ?>
|
|
#[ORM\Id]
|
|
#[ORM\Column(type: UuidType::NAME, unique: true)]
|
|
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
|
|
#[ORM\CustomIdGenerator(class: 'doctrine.uuid_generator')]
|
|
private ?Uuid $id = null;
|
|
|
|
public function getId(): ?Uuid
|
|
{
|
|
return $this->id;
|
|
}
|
|
<?php elseif (EntityIdTypeEnum::ULID === $id_type): ?>
|
|
#[ORM\Id]
|
|
#[ORM\Column(type: UlidType::NAME, unique: true)]
|
|
#[ORM\GeneratedValue(strategy: 'CUSTOM')]
|
|
#[ORM\CustomIdGenerator(class: 'doctrine.ulid_generator')]
|
|
private ?Ulid $id = null;
|
|
|
|
public function getId(): ?Ulid
|
|
{
|
|
return $this->id;
|
|
}
|
|
<?php else: ?>
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column]
|
|
private ?int $id = null;
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
<?php endif ?>
|
|
}
|