initial commit
This commit is contained in:
56
vendor/symfony/maker-bundle/templates/doctrine/Entity.tpl.php
vendored
Normal file
56
vendor/symfony/maker-bundle/templates/doctrine/Entity.tpl.php
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
<?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 ?>
|
||||
}
|
||||
16
vendor/symfony/maker-bundle/templates/doctrine/Fixtures.tpl.php
vendored
Normal file
16
vendor/symfony/maker-bundle/templates/doctrine/Fixtures.tpl.php
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<?= "<?php\n" ?>
|
||||
|
||||
namespace <?= $namespace; ?>;
|
||||
|
||||
<?= $use_statements; ?>
|
||||
|
||||
class <?= $class_name ?> extends Fixture
|
||||
{
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
// $product = new Product();
|
||||
// $manager->persist($product);
|
||||
|
||||
$manager->flush();
|
||||
}
|
||||
}
|
||||
61
vendor/symfony/maker-bundle/templates/doctrine/Repository.tpl.php
vendored
Normal file
61
vendor/symfony/maker-bundle/templates/doctrine/Repository.tpl.php
vendored
Normal file
@@ -0,0 +1,61 @@
|
||||
<?= "<?php\n"; ?>
|
||||
|
||||
namespace <?= $namespace; ?>;
|
||||
|
||||
<?= $use_statements; ?>
|
||||
|
||||
/**
|
||||
* @extends ServiceEntityRepository<<?= $entity_class_name; ?>>
|
||||
*/
|
||||
class <?= $class_name; ?> extends ServiceEntityRepository<?= $with_password_upgrade ? " implements PasswordUpgraderInterface\n" : "\n" ?>
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, <?= $entity_class_name; ?>::class);
|
||||
}
|
||||
<?php if ($include_example_comments): // When adding a new method without existing default comments, the blank line is automatically added.?>
|
||||
|
||||
<?php endif; ?>
|
||||
<?php if ($with_password_upgrade): ?>
|
||||
/**
|
||||
* Used to upgrade (rehash) the user's password automatically over time.
|
||||
*/
|
||||
public function upgradePassword(<?= sprintf('%s ', $password_upgrade_user_interface->getShortName()); ?>$user, string $newHashedPassword): void
|
||||
{
|
||||
if (!$user instanceof <?= $entity_class_name ?>) {
|
||||
throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', $user::class));
|
||||
}
|
||||
|
||||
$user->setPassword($newHashedPassword);
|
||||
$this->getEntityManager()->persist($user);
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
|
||||
<?php endif ?>
|
||||
<?php if ($include_example_comments): ?>
|
||||
// /**
|
||||
// * @return <?= $entity_class_name ?>[] Returns an array of <?= $entity_class_name ?> objects
|
||||
// */
|
||||
// public function findByExampleField($value): array
|
||||
// {
|
||||
// return $this->createQueryBuilder('<?= $entity_alias; ?>')
|
||||
// ->andWhere('<?= $entity_alias; ?>.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->orderBy('<?= $entity_alias; ?>.id', 'ASC')
|
||||
// ->setMaxResults(10)
|
||||
// ->getQuery()
|
||||
// ->getResult()
|
||||
// ;
|
||||
// }
|
||||
|
||||
// public function findOneBySomeField($value): ?<?= $entity_class_name."\n" ?>
|
||||
// {
|
||||
// return $this->createQueryBuilder('<?= $entity_alias ?>')
|
||||
// ->andWhere('<?= $entity_alias ?>.exampleField = :val')
|
||||
// ->setParameter('val', $value)
|
||||
// ->getQuery()
|
||||
// ->getOneOrNullResult()
|
||||
// ;
|
||||
// }
|
||||
<?php endif; ?>
|
||||
}
|
||||
22
vendor/symfony/maker-bundle/templates/doctrine/broadcast_twig_template.tpl.php
vendored
Normal file
22
vendor/symfony/maker-bundle/templates/doctrine/broadcast_twig_template.tpl.php
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{# Learn how to use Turbo Streams: https://github.com/symfony/ux-turbo#broadcast-doctrine-entities-update #}
|
||||
{% block create %}
|
||||
<turbo-stream action="append" target="<?= $class_name_plural ?>">
|
||||
<template>
|
||||
<div id="{{ '<?= $class_name ?>_' ~ id }}">
|
||||
#{{ id }} created
|
||||
</div>
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% endblock %}
|
||||
|
||||
{% block update %}
|
||||
<turbo-stream action="update" target="<?= $class_name ?>_{{ id }}">
|
||||
<template>
|
||||
#{{ id }} updated
|
||||
</template>
|
||||
</turbo-stream>
|
||||
{% endblock %}
|
||||
|
||||
{% block remove %}
|
||||
<turbo-stream action="remove" target="<?= $class_name ?>_{{ id }}"></turbo-stream>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user