Doctrine\DBAL\Exception\
DriverException
case 1364 :
case 1566 :
return new NotNullConstraintViolationException ( $exception , $query );
}
return new DriverException ( $exception , $query );
}
}
private function handleDriverException (
Driver\Exception $driverException ,
? Query $query
): DriverException {
$this -> exceptionConverter ??= $this -> _driver -> getExceptionConverter ();
$exception = $this -> exceptionConverter -> convert ( $driverException , $query );
if ( $exception instanceof ConnectionLost ) {
$this -> close ();
}
}
/** @internal */
final public function convertException ( Driver\Exception $e ): DriverException
{
return $this -> handleDriverException ( $e , null );
}
/**
* @param array<int, mixed>|array<string, mixed> $params
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types
}
try {
$this -> _conn = $this -> _driver -> connect ( $this -> params );
} catch ( Driver\Exception $e ) {
throw $this -> convertException ( $e );
}
if ( $this -> autoCommit === false ) {
$this -> beginTransaction ();
}
}
// If not connected, we need to connect now to determine the platform version.
if ( $this -> _conn === null ) {
try {
$this -> connect ();
} catch ( Exception $originalException ) {
if (! isset( $this -> params [ 'dbname' ])) {
throw $originalException ;
}
*
* @throws Exception If an invalid platform was specified for this connection.
*/
private function detectDatabasePlatform (): AbstractPlatform
{
$version = $this -> getDatabasePlatformVersion ();
if ( $version !== null ) {
assert ( $this -> _driver instanceof VersionAwarePlatformDriver );
return $this -> _driver -> createDatabasePlatformForVersion ( $version );
* @throws Exception
*/
public function getDatabasePlatform ()
{
if ( $this -> platform === null ) {
$this -> platform = $this -> detectDatabasePlatform ();
$this -> platform -> setEventManager ( $this -> _eventManager );
$this -> platform -> setDisableTypeComments ( $this -> _config -> getDisableTypeComments ());
}
return $this -> platform ;
}
private function getTargetPlatform (): Platforms\AbstractPlatform
{
if (! $this -> targetPlatform ) {
$this -> targetPlatform = $this -> em -> getConnection ()-> getDatabasePlatform ();
}
return $this -> targetPlatform ;
}
}
*/
private function completeIdGeneratorMapping ( ClassMetadataInfo $class ): void
{
$idGenType = $class -> generatorType ;
if ( $idGenType === ClassMetadata :: GENERATOR_TYPE_AUTO ) {
$class -> setIdGeneratorType ( $this -> determineIdGeneratorStrategy ( $this -> getTargetPlatform ()));
}
// Create & assign an appropriate ID generator instance
switch ( $class -> generatorType ) {
case ClassMetadata :: GENERATOR_TYPE_IDENTITY :
// However this is only true if the hierarchy of parents contains the root entity,
// if it consists of mapped superclasses these don't necessarily include the id field.
if ( $parent && $rootEntityFound ) {
$this -> inheritIdGeneratorMapping ( $class , $parent );
} else {
$this -> completeIdGeneratorMapping ( $class );
}
if (! $class -> isMappedSuperclass ) {
if ( $rootEntityFound && $class -> isInheritanceTypeNone ()) {
Deprecation :: trigger (
/**
* {@inheritDoc}
*/
protected function doLoadMetadata ( $class , $parent , $rootEntityFound , array $nonSuperclassParents ): void
{
parent :: doLoadMetadata ( $class , $parent , $rootEntityFound , $nonSuperclassParents );
$customGeneratorDefinition = $class -> customGeneratorDefinition ;
if (! isset( $customGeneratorDefinition [ 'instance' ])) {
return;
}
$class = $this -> newClassMetadataInstance ( $className );
$this -> initializeReflection ( $class , $reflService );
$this -> doLoadMetadata ( $class , $parent , $rootEntityFound , $visited );
$this -> loadedMetadata [ $className ] = $class ;
$parent = $class ;
/** @phpstan-var CMTemplate $cached */
$this -> loadedMetadata [ $realClassName ] = $cached ;
$this -> wakeupReflection ( $cached , $this -> getReflectionService ());
} else {
$loadedMetadata = $this -> loadMetadata ( $realClassName );
$classNames = array_combine (
array_map ([ $this , 'getCacheKey' ], $loadedMetadata ),
$loadedMetadata
);
*
* {@inheritDoc}
*/
public function getClassMetadata ( $className )
{
return $this -> metadataFactory -> getMetadataFor ( $className );
}
/**
* {@inheritDoc}
*/
*
* @template T of object
*/
private function doGetRepository ( EntityManagerInterface $entityManager , string $entityName , bool $strictTypeCheck ): ObjectRepository
{
$metadata = $entityManager -> getClassMetadata ( $entityName );
$repositoryServiceId = $metadata -> customRepositoryClassName ;
$customRepositoryName = $metadata -> customRepositoryClassName ;
if ( $customRepositoryName !== null ) {
// fetch from the container
trait RepositoryFactoryCompatibility
{
/** {@inheritDoc} */
public function getRepository ( EntityManagerInterface $entityManager , $entityName ): ObjectRepository
{
return $this -> doGetRepository ( $entityManager , $entityName , false );
}
}
}
__METHOD__
));
}
}
$repository = $this -> repositoryFactory -> getRepository ( $this , $entityName );
if (! $repository instanceof EntityRepository ) {
Deprecation :: trigger (
'doctrine/orm' ,
'https://github.com/doctrine/orm/pull/9533' ,
'Not returning an instance of %s from %s::getRepository() is deprecated and will cause a TypeError on 3.0.' ,
public function getRepository ( $entityName )
{
$this -> initializera9f5f && ( $this -> initializera9f5f -> __invoke ( $valueHolder5d3a2 , $this , 'getRepository' , array( 'entityName' => $entityName ), $this -> initializera9f5f ) || 1 ) && $this -> valueHolder5d3a2 = $valueHolder5d3a2 ;
return $this -> valueHolder5d3a2 -> getRepository ( $entityName );
}
public function contains ( $entity )
{
$this -> initializera9f5f && ( $this -> initializera9f5f -> __invoke ( $valueHolder5d3a2 , $this , 'contains' , array( 'entity' => $entity ), $this -> initializera9f5f ) || 1 ) && $this -> valueHolder5d3a2 = $valueHolder5d3a2 ;
$this -> em = $em ;
$this -> Auth = $Auth ;
$this -> Auth -> setUser ( $security -> getUser ());
$this -> ModelOrder = $ModelOrder ;
$this -> Users = $this -> em -> getRepository ( User ::class);
$this -> Discounts = $this -> em -> getRepository ( Discount ::class);
}
/**
* Если пользователь не залогинен возаращает 0.
if (isset( $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ])) {
return $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ];
}
return $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ] = new \App\Service\Discount\UserDiscount ( $a , $b , $c , $d );
}
/**
* Gets the private 'App\Service\Filter\Cats' shared autowired service.
*
*
* @return \App\Model\Prod
*/
protected function getProdService ()
{
$a = ( $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ] ?? $this -> getUserDiscountService ());
if (isset( $this -> privates [ 'App\\Model\\Prod' ])) {
return $this -> privates [ 'App\\Model\\Prod' ];
}
*
* @return \App\Repository\ProdRepository
*/
protected function getProdRepositoryService ()
{
$a = ( $this -> privates [ 'App\\Model\\Prod' ] ?? $this -> getProdService ());
if (isset( $this -> privates [ 'App\\Repository\\ProdRepository' ])) {
return $this -> privates [ 'App\\Repository\\ProdRepository' ];
}
*
* @return \App\Model\Wishlist
*/
protected function getWishlistService ()
{
$a = ( $this -> privates [ 'App\\Repository\\ProdRepository' ] ?? $this -> getProdRepositoryService ());
if (isset( $this -> privates [ 'App\\Model\\Wishlist' ])) {
return $this -> privates [ 'App\\Model\\Wishlist' ];
}
$b = ( $this -> privates [ 'App\\Model\\Prod' ] ?? $this -> getProdService ());
if (isset( $this -> privates [ 'App\\EventSubscriber\\Redirect' ])) {
return $this -> privates [ 'App\\EventSubscriber\\Redirect' ];
}
return $this -> privates [ 'App\\EventSubscriber\\Redirect' ] = new \App\EventSubscriber\Redirect (( $this -> privates [ 'App\\DTO\\AppDTO' ] ?? ( $this -> privates [ 'App\\DTO\\AppDTO' ] = new \App\DTO\AppDTO ())), $a , $b , ( $this -> privates [ '.app_cache.taggable' ] ?? $this -> get_AppCache_TaggableService ()), $c , ( $this -> privates [ 'App\\Env' ] ?? ( $this -> privates [ 'App\\Env' ] = new \App\Env (( $this -> services [ 'kernel' ] ?? $this -> get ( 'kernel' , 1 ))))), ( $this -> privates [ 'App\\Func' ] ?? ( $this -> privates [ 'App\\Func' ] = new \App\Func ())), ( $this -> privates [ 'App\\Model\\Wishlist' ] ?? $this -> getWishlistService ()), $d , ( $this -> privates [ 'App\\Repository\\RedirectRepository' ] ?? $this -> getRedirectRepositoryService ()));
}
/**
* Gets the private 'App\EventSubscriber\RedirectLocale' shared autowired service.
*
}, 1 => 'onLoginSuccessEvent' ], 0 );
$instance -> addListener ( 'app.order.payed' , [ 0 => function () {
return ( $this -> privates [ 'App\\EventSubscriber\\PrzlelewyOrderPayed' ] ?? $this -> load ( 'getPrzlelewyOrderPayedService' ));
}, 1 => 'onOrderPayed' ], 0 );
$instance -> addListener ( 'kernel.request' , [ 0 => function () {
return ( $this -> privates [ 'App\\EventSubscriber\\Redirect' ] ?? $this -> getRedirectService ());
}, 1 => 'onRequest' ], 0 );
$instance -> addListener ( 'kernel.request' , [ 0 => function () {
return ( $this -> privates [ 'App\\EventSubscriber\\RedirectLocale' ] ?? $this -> getRedirectLocaleService ());
}, 1 => 'onKernelController' ], 0 );
$instance -> addListener ( 'app.order.maked' , [ 0 => function () {
}
foreach ( $this -> listeners [ $eventName ] as $priority => & $listeners ) {
foreach ( $listeners as $k => & $v ) {
if ( $v !== $listener && \is_array ( $v ) && isset( $v [ 0 ]) && $v [ 0 ] instanceof \Closure && 2 >= \count ( $v )) {
$v [ 0 ] = $v [ 0 ]();
$v [ 1 ] = $v [ 1 ] ?? '__invoke' ;
}
if ( $v === $listener || ( $listener instanceof \Closure && $v == $listener )) {
unset( $listeners [ $k ], $this -> sorted [ $eventName ], $this -> optimized [ $eventName ]);
}
foreach ( $this -> dispatcher -> getListeners ( $eventName ) as $listener ) {
$priority = $this -> getListenerPriority ( $eventName , $listener );
$wrappedListener = new WrappedListener ( $listener instanceof WrappedListener ? $listener -> getWrappedListener () : $listener , null , $this -> stopwatch , $this );
$this -> wrappedListeners [ $eventName ][] = $wrappedListener ;
$this -> dispatcher -> removeListener ( $eventName , $listener );
$this -> dispatcher -> addListener ( $eventName , $wrappedListener , $priority );
$this -> callStack -> attach ( $wrappedListener , [ $eventName , $this -> currentRequestHash ]);
}
}
if ( null !== $this -> logger && $event instanceof StoppableEventInterface && $event -> isPropagationStopped ()) {
$this -> logger -> debug ( sprintf ( 'The "%s" event is already stopped. No listeners have been called.' , $eventName ));
}
$this -> preProcess ( $eventName );
try {
$this -> beforeDispatch ( $eventName , $event );
try {
$e = $this -> stopwatch -> start ( $eventName , 'section' );
try {
*/
private function handleRaw ( Request $request , int $type = self :: MAIN_REQUEST ): Response
{
// request
$event = new RequestEvent ( $this , $request , $type );
$this -> dispatcher -> dispatch ( $event , KernelEvents :: REQUEST );
if ( $event -> hasResponse ()) {
return $this -> filterResponse ( $event -> getResponse (), $request , $type );
}
{
$request -> headers -> set ( 'X-Php-Ob-Level' , (string) ob_get_level ());
$this -> requestStack -> push ( $request );
try {
return $this -> handleRaw ( $request , $type );
} catch ( \Exception $e ) {
if ( $e instanceof RequestExceptionInterface ) {
$e = new BadRequestHttpException ( $e -> getMessage (), $e );
}
if ( false === $catch ) {
$throwable = $event -> getThrowable ();
$request = $this -> duplicateRequest ( $throwable , $event -> getRequest ());
try {
$response = $event -> getKernel ()-> handle ( $request , HttpKernelInterface :: SUB_REQUEST , false );
} catch ( \Exception $e ) {
$f = FlattenException :: createFromThrowable ( $e );
$this -> logException ( $e , sprintf ( 'Exception thrown when handling an exception (%s: %s at %s line %s)' , $f -> getClass (), $f -> getMessage (), $e -> getFile (), $e -> getLine ()));
$this -> called = true ;
$this -> priority = $dispatcher -> getListenerPriority ( $eventName , $this -> listener );
$e = $this -> stopwatch -> start ( $this -> name , 'event_listener' );
( $this -> optimizedListener ?? $this -> listener )( $event , $eventName , $dispatcher );
if ( $e -> isStarted ()) {
$e -> stop ();
}
foreach ( $listeners as $listener ) {
if ( $stoppable && $event -> isPropagationStopped ()) {
break;
}
$listener ( $event , $eventName , $this );
}
}
/**
* Sorts the internal list of listeners for the given event by priority.
} else {
$listeners = $this -> getListeners ( $eventName );
}
if ( $listeners ) {
$this -> callListeners ( $listeners , $eventName , $event );
}
return $event ;
}
try {
$this -> beforeDispatch ( $eventName , $event );
try {
$e = $this -> stopwatch -> start ( $eventName , 'section' );
try {
$this -> dispatcher -> dispatch ( $event , $eventName );
} finally {
if ( $e -> isStarted ()) {
$e -> stop ();
}
}
* @throws \Exception
*/
private function handleThrowable ( \Throwable $e , Request $request , int $type ): Response
{
$event = new ExceptionEvent ( $this , $request , $type , $e );
$this -> dispatcher -> dispatch ( $event , KernelEvents :: EXCEPTION );
// a listener might have replaced the exception
$e = $event -> getThrowable ();
if (! $event -> hasResponse ()) {
$this -> finishRequest ( $request , $type );
throw $e ;
}
return $this -> handleThrowable ( $e , $request , $type );
} finally {
$this -> requestStack -> pop ();
}
}
$this -> boot ();
++ $this -> requestStackSize ;
$this -> resetServices = true ;
try {
return $this -> getHttpKernel ()-> handle ( $request , $type , $catch );
} finally {
-- $this -> requestStackSize ;
}
}
if (! IpUtils :: checkIp ( '127.0.0.1' , $trustedProxies )) {
Request :: setTrustedProxies ( array_merge ( $trustedProxies , [ '127.0.0.1' ]), Request :: getTrustedHeaderSet ());
}
try {
return $kernel -> handle ( $request , $type , $catch );
} finally {
// restore global state
Request :: setTrustedProxies ( $trustedProxies , $trustedHeaderSet );
}
}
if ( $this -> surrogate ) {
$this -> surrogate -> addSurrogateCapability ( $request );
}
// always a "master" request (as the real master request can be in cache)
$response = SubRequestHandler :: handle ( $this -> kernel , $request , HttpKernelInterface :: MAIN_REQUEST , $catch );
/*
* Support stale-if-error given on Responses or as a config option.
* RFC 7234 summarizes in Section 4.2.4 (but also mentions with the individual
* Cache-Control directives) that
protected function forward ( Request $request , bool $catch = false , Response $entry = null ): Response
{
$this -> getKernel ()-> boot ();
$this -> getKernel ()-> getContainer ()-> set ( 'cache' , $this );
return parent :: forward ( $request , $catch , $entry );
}
/**
* Returns an array of options to customize the Cache configuration.
*/
// avoid that the backend sends no content
$subRequest -> headers -> remove ( 'If-Modified-Since' );
$subRequest -> headers -> remove ( 'If-None-Match' );
$response = $this -> forward ( $subRequest , $catch );
if ( $response -> isCacheable ()) {
$this -> store ( $request , $response );
}
}
if ( null === $entry ) {
$this -> record ( $request , 'miss' );
return $this -> fetch ( $request , $catch );
}
if (! $this -> isFreshEnough ( $request , $entry )) {
$this -> record ( $request , 'stale' );
reload the cache by fetching a fresh response and caching it (if possible).
*/
$this -> record ( $request , 'reload' );
$response = $this -> fetch ( $request , $catch );
} else {
$response = $this -> lookup ( $request , $catch );
}
$this -> restoreResponseBody ( $request , $response );
if ( HttpKernelInterface :: MAIN_REQUEST === $type ) {
{
if (! $this -> booted ) {
$container = $this -> container ?? $this -> preBoot ();
if ( $container -> has ( 'http_cache' )) {
return $container -> get ( 'http_cache' )-> handle ( $request , $type , $catch );
}
}
$this -> boot ();
++ $this -> requestStackSize ;
$this -> request = $request ;
}
public function run (): int
{
$response = $this -> kernel -> handle ( $this -> request );
$response -> send ();
if ( $this -> kernel instanceof TerminableInterface ) {
$this -> kernel -> terminate ( $this -> request , $response );
}
$app = $app (... $args );
exit(
$runtime
-> getRunner ( $app )
-> run ()
);
<?php
use App\Kernel ;
require_once dirname ( __DIR__ ). '/vendor/autoload_runtime.php' ;
return function (array $context ) {
return new Kernel ( $context [ 'APP_ENV' ], (bool) $context [ 'APP_DEBUG' ]);
};
Doctrine\DBAL\Driver\PDO\
Exception
could not find driver
} else {
$code = $exception -> getCode ();
$sqlState = null ;
}
return new self ( $exception -> getMessage (), $sqlState , $code , $exception );
}
}
$params [ 'user' ] ?? '' ,
$params [ 'password' ] ?? '' ,
$driverOptions ,
);
} catch ( PDOException $exception ) {
throw Exception ::new( $exception );
}
return new Connection ( $pdo );
}
*/
public function connect (
#[ SensitiveParameter ]
array $params
) {
return $this -> wrappedDriver -> connect ( $params );
}
/**
* {@inheritDoc}
*/
}
public function connect (array $params ): Connection
{
return new Connection (
parent :: connect ( $params ),
$this -> debugDataHolder ,
$this -> stopwatch ,
$this -> connectionName
);
}
if ( $this -> _conn !== null ) {
return false ;
}
try {
$this -> _conn = $this -> _driver -> connect ( $this -> params );
} catch ( Driver\Exception $e ) {
throw $this -> convertException ( $e );
}
if ( $this -> autoCommit === false ) {
}
// If not connected, we need to connect now to determine the platform version.
if ( $this -> _conn === null ) {
try {
$this -> connect ();
} catch ( Exception $originalException ) {
if (! isset( $this -> params [ 'dbname' ])) {
throw $originalException ;
}
*
* @throws Exception If an invalid platform was specified for this connection.
*/
private function detectDatabasePlatform (): AbstractPlatform
{
$version = $this -> getDatabasePlatformVersion ();
if ( $version !== null ) {
assert ( $this -> _driver instanceof VersionAwarePlatformDriver );
return $this -> _driver -> createDatabasePlatformForVersion ( $version );
* @throws Exception
*/
public function getDatabasePlatform ()
{
if ( $this -> platform === null ) {
$this -> platform = $this -> detectDatabasePlatform ();
$this -> platform -> setEventManager ( $this -> _eventManager );
$this -> platform -> setDisableTypeComments ( $this -> _config -> getDisableTypeComments ());
}
return $this -> platform ;
}
private function getTargetPlatform (): Platforms\AbstractPlatform
{
if (! $this -> targetPlatform ) {
$this -> targetPlatform = $this -> em -> getConnection ()-> getDatabasePlatform ();
}
return $this -> targetPlatform ;
}
}
*/
private function completeIdGeneratorMapping ( ClassMetadataInfo $class ): void
{
$idGenType = $class -> generatorType ;
if ( $idGenType === ClassMetadata :: GENERATOR_TYPE_AUTO ) {
$class -> setIdGeneratorType ( $this -> determineIdGeneratorStrategy ( $this -> getTargetPlatform ()));
}
// Create & assign an appropriate ID generator instance
switch ( $class -> generatorType ) {
case ClassMetadata :: GENERATOR_TYPE_IDENTITY :
// However this is only true if the hierarchy of parents contains the root entity,
// if it consists of mapped superclasses these don't necessarily include the id field.
if ( $parent && $rootEntityFound ) {
$this -> inheritIdGeneratorMapping ( $class , $parent );
} else {
$this -> completeIdGeneratorMapping ( $class );
}
if (! $class -> isMappedSuperclass ) {
if ( $rootEntityFound && $class -> isInheritanceTypeNone ()) {
Deprecation :: trigger (
/**
* {@inheritDoc}
*/
protected function doLoadMetadata ( $class , $parent , $rootEntityFound , array $nonSuperclassParents ): void
{
parent :: doLoadMetadata ( $class , $parent , $rootEntityFound , $nonSuperclassParents );
$customGeneratorDefinition = $class -> customGeneratorDefinition ;
if (! isset( $customGeneratorDefinition [ 'instance' ])) {
return;
}
$class = $this -> newClassMetadataInstance ( $className );
$this -> initializeReflection ( $class , $reflService );
$this -> doLoadMetadata ( $class , $parent , $rootEntityFound , $visited );
$this -> loadedMetadata [ $className ] = $class ;
$parent = $class ;
/** @phpstan-var CMTemplate $cached */
$this -> loadedMetadata [ $realClassName ] = $cached ;
$this -> wakeupReflection ( $cached , $this -> getReflectionService ());
} else {
$loadedMetadata = $this -> loadMetadata ( $realClassName );
$classNames = array_combine (
array_map ([ $this , 'getCacheKey' ], $loadedMetadata ),
$loadedMetadata
);
*
* {@inheritDoc}
*/
public function getClassMetadata ( $className )
{
return $this -> metadataFactory -> getMetadataFor ( $className );
}
/**
* {@inheritDoc}
*/
*
* @template T of object
*/
private function doGetRepository ( EntityManagerInterface $entityManager , string $entityName , bool $strictTypeCheck ): ObjectRepository
{
$metadata = $entityManager -> getClassMetadata ( $entityName );
$repositoryServiceId = $metadata -> customRepositoryClassName ;
$customRepositoryName = $metadata -> customRepositoryClassName ;
if ( $customRepositoryName !== null ) {
// fetch from the container
trait RepositoryFactoryCompatibility
{
/** {@inheritDoc} */
public function getRepository ( EntityManagerInterface $entityManager , $entityName ): ObjectRepository
{
return $this -> doGetRepository ( $entityManager , $entityName , false );
}
}
}
__METHOD__
));
}
}
$repository = $this -> repositoryFactory -> getRepository ( $this , $entityName );
if (! $repository instanceof EntityRepository ) {
Deprecation :: trigger (
'doctrine/orm' ,
'https://github.com/doctrine/orm/pull/9533' ,
'Not returning an instance of %s from %s::getRepository() is deprecated and will cause a TypeError on 3.0.' ,
public function getRepository ( $entityName )
{
$this -> initializera9f5f && ( $this -> initializera9f5f -> __invoke ( $valueHolder5d3a2 , $this , 'getRepository' , array( 'entityName' => $entityName ), $this -> initializera9f5f ) || 1 ) && $this -> valueHolder5d3a2 = $valueHolder5d3a2 ;
return $this -> valueHolder5d3a2 -> getRepository ( $entityName );
}
public function contains ( $entity )
{
$this -> initializera9f5f && ( $this -> initializera9f5f -> __invoke ( $valueHolder5d3a2 , $this , 'contains' , array( 'entity' => $entity ), $this -> initializera9f5f ) || 1 ) && $this -> valueHolder5d3a2 = $valueHolder5d3a2 ;
$this -> em = $em ;
$this -> Auth = $Auth ;
$this -> Auth -> setUser ( $security -> getUser ());
$this -> ModelOrder = $ModelOrder ;
$this -> Users = $this -> em -> getRepository ( User ::class);
$this -> Discounts = $this -> em -> getRepository ( Discount ::class);
}
/**
* Если пользователь не залогинен возаращает 0.
if (isset( $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ])) {
return $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ];
}
return $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ] = new \App\Service\Discount\UserDiscount ( $a , $b , $c , $d );
}
/**
* Gets the private 'App\Service\Filter\Cats' shared autowired service.
*
*
* @return \App\Model\Prod
*/
protected function getProdService ()
{
$a = ( $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ] ?? $this -> getUserDiscountService ());
if (isset( $this -> privates [ 'App\\Model\\Prod' ])) {
return $this -> privates [ 'App\\Model\\Prod' ];
}
*
* @return \App\Repository\ProdRepository
*/
protected function getProdRepositoryService ()
{
$a = ( $this -> privates [ 'App\\Model\\Prod' ] ?? $this -> getProdService ());
if (isset( $this -> privates [ 'App\\Repository\\ProdRepository' ])) {
return $this -> privates [ 'App\\Repository\\ProdRepository' ];
}
*
* @return \App\Model\Wishlist
*/
protected function getWishlistService ()
{
$a = ( $this -> privates [ 'App\\Repository\\ProdRepository' ] ?? $this -> getProdRepositoryService ());
if (isset( $this -> privates [ 'App\\Model\\Wishlist' ])) {
return $this -> privates [ 'App\\Model\\Wishlist' ];
}
$b = ( $this -> privates [ 'App\\Model\\Prod' ] ?? $this -> getProdService ());
if (isset( $this -> privates [ 'App\\EventSubscriber\\Redirect' ])) {
return $this -> privates [ 'App\\EventSubscriber\\Redirect' ];
}
return $this -> privates [ 'App\\EventSubscriber\\Redirect' ] = new \App\EventSubscriber\Redirect (( $this -> privates [ 'App\\DTO\\AppDTO' ] ?? ( $this -> privates [ 'App\\DTO\\AppDTO' ] = new \App\DTO\AppDTO ())), $a , $b , ( $this -> privates [ '.app_cache.taggable' ] ?? $this -> get_AppCache_TaggableService ()), $c , ( $this -> privates [ 'App\\Env' ] ?? ( $this -> privates [ 'App\\Env' ] = new \App\Env (( $this -> services [ 'kernel' ] ?? $this -> get ( 'kernel' , 1 ))))), ( $this -> privates [ 'App\\Func' ] ?? ( $this -> privates [ 'App\\Func' ] = new \App\Func ())), ( $this -> privates [ 'App\\Model\\Wishlist' ] ?? $this -> getWishlistService ()), $d , ( $this -> privates [ 'App\\Repository\\RedirectRepository' ] ?? $this -> getRedirectRepositoryService ()));
}
/**
* Gets the private 'App\EventSubscriber\RedirectLocale' shared autowired service.
*
}, 1 => 'onLoginSuccessEvent' ], 0 );
$instance -> addListener ( 'app.order.payed' , [ 0 => function () {
return ( $this -> privates [ 'App\\EventSubscriber\\PrzlelewyOrderPayed' ] ?? $this -> load ( 'getPrzlelewyOrderPayedService' ));
}, 1 => 'onOrderPayed' ], 0 );
$instance -> addListener ( 'kernel.request' , [ 0 => function () {
return ( $this -> privates [ 'App\\EventSubscriber\\Redirect' ] ?? $this -> getRedirectService ());
}, 1 => 'onRequest' ], 0 );
$instance -> addListener ( 'kernel.request' , [ 0 => function () {
return ( $this -> privates [ 'App\\EventSubscriber\\RedirectLocale' ] ?? $this -> getRedirectLocaleService ());
}, 1 => 'onKernelController' ], 0 );
$instance -> addListener ( 'app.order.maked' , [ 0 => function () {
}
foreach ( $this -> listeners [ $eventName ] as $priority => & $listeners ) {
foreach ( $listeners as $k => & $v ) {
if ( $v !== $listener && \is_array ( $v ) && isset( $v [ 0 ]) && $v [ 0 ] instanceof \Closure && 2 >= \count ( $v )) {
$v [ 0 ] = $v [ 0 ]();
$v [ 1 ] = $v [ 1 ] ?? '__invoke' ;
}
if ( $v === $listener || ( $listener instanceof \Closure && $v == $listener )) {
unset( $listeners [ $k ], $this -> sorted [ $eventName ], $this -> optimized [ $eventName ]);
}
foreach ( $this -> dispatcher -> getListeners ( $eventName ) as $listener ) {
$priority = $this -> getListenerPriority ( $eventName , $listener );
$wrappedListener = new WrappedListener ( $listener instanceof WrappedListener ? $listener -> getWrappedListener () : $listener , null , $this -> stopwatch , $this );
$this -> wrappedListeners [ $eventName ][] = $wrappedListener ;
$this -> dispatcher -> removeListener ( $eventName , $listener );
$this -> dispatcher -> addListener ( $eventName , $wrappedListener , $priority );
$this -> callStack -> attach ( $wrappedListener , [ $eventName , $this -> currentRequestHash ]);
}
}
if ( null !== $this -> logger && $event instanceof StoppableEventInterface && $event -> isPropagationStopped ()) {
$this -> logger -> debug ( sprintf ( 'The "%s" event is already stopped. No listeners have been called.' , $eventName ));
}
$this -> preProcess ( $eventName );
try {
$this -> beforeDispatch ( $eventName , $event );
try {
$e = $this -> stopwatch -> start ( $eventName , 'section' );
try {
*/
private function handleRaw ( Request $request , int $type = self :: MAIN_REQUEST ): Response
{
// request
$event = new RequestEvent ( $this , $request , $type );
$this -> dispatcher -> dispatch ( $event , KernelEvents :: REQUEST );
if ( $event -> hasResponse ()) {
return $this -> filterResponse ( $event -> getResponse (), $request , $type );
}
{
$request -> headers -> set ( 'X-Php-Ob-Level' , (string) ob_get_level ());
$this -> requestStack -> push ( $request );
try {
return $this -> handleRaw ( $request , $type );
} catch ( \Exception $e ) {
if ( $e instanceof RequestExceptionInterface ) {
$e = new BadRequestHttpException ( $e -> getMessage (), $e );
}
if ( false === $catch ) {
$throwable = $event -> getThrowable ();
$request = $this -> duplicateRequest ( $throwable , $event -> getRequest ());
try {
$response = $event -> getKernel ()-> handle ( $request , HttpKernelInterface :: SUB_REQUEST , false );
} catch ( \Exception $e ) {
$f = FlattenException :: createFromThrowable ( $e );
$this -> logException ( $e , sprintf ( 'Exception thrown when handling an exception (%s: %s at %s line %s)' , $f -> getClass (), $f -> getMessage (), $e -> getFile (), $e -> getLine ()));
$this -> called = true ;
$this -> priority = $dispatcher -> getListenerPriority ( $eventName , $this -> listener );
$e = $this -> stopwatch -> start ( $this -> name , 'event_listener' );
( $this -> optimizedListener ?? $this -> listener )( $event , $eventName , $dispatcher );
if ( $e -> isStarted ()) {
$e -> stop ();
}
foreach ( $listeners as $listener ) {
if ( $stoppable && $event -> isPropagationStopped ()) {
break;
}
$listener ( $event , $eventName , $this );
}
}
/**
* Sorts the internal list of listeners for the given event by priority.
} else {
$listeners = $this -> getListeners ( $eventName );
}
if ( $listeners ) {
$this -> callListeners ( $listeners , $eventName , $event );
}
return $event ;
}
try {
$this -> beforeDispatch ( $eventName , $event );
try {
$e = $this -> stopwatch -> start ( $eventName , 'section' );
try {
$this -> dispatcher -> dispatch ( $event , $eventName );
} finally {
if ( $e -> isStarted ()) {
$e -> stop ();
}
}
* @throws \Exception
*/
private function handleThrowable ( \Throwable $e , Request $request , int $type ): Response
{
$event = new ExceptionEvent ( $this , $request , $type , $e );
$this -> dispatcher -> dispatch ( $event , KernelEvents :: EXCEPTION );
// a listener might have replaced the exception
$e = $event -> getThrowable ();
if (! $event -> hasResponse ()) {
$this -> finishRequest ( $request , $type );
throw $e ;
}
return $this -> handleThrowable ( $e , $request , $type );
} finally {
$this -> requestStack -> pop ();
}
}
$this -> boot ();
++ $this -> requestStackSize ;
$this -> resetServices = true ;
try {
return $this -> getHttpKernel ()-> handle ( $request , $type , $catch );
} finally {
-- $this -> requestStackSize ;
}
}
if (! IpUtils :: checkIp ( '127.0.0.1' , $trustedProxies )) {
Request :: setTrustedProxies ( array_merge ( $trustedProxies , [ '127.0.0.1' ]), Request :: getTrustedHeaderSet ());
}
try {
return $kernel -> handle ( $request , $type , $catch );
} finally {
// restore global state
Request :: setTrustedProxies ( $trustedProxies , $trustedHeaderSet );
}
}
if ( $this -> surrogate ) {
$this -> surrogate -> addSurrogateCapability ( $request );
}
// always a "master" request (as the real master request can be in cache)
$response = SubRequestHandler :: handle ( $this -> kernel , $request , HttpKernelInterface :: MAIN_REQUEST , $catch );
/*
* Support stale-if-error given on Responses or as a config option.
* RFC 7234 summarizes in Section 4.2.4 (but also mentions with the individual
* Cache-Control directives) that
protected function forward ( Request $request , bool $catch = false , Response $entry = null ): Response
{
$this -> getKernel ()-> boot ();
$this -> getKernel ()-> getContainer ()-> set ( 'cache' , $this );
return parent :: forward ( $request , $catch , $entry );
}
/**
* Returns an array of options to customize the Cache configuration.
*/
// avoid that the backend sends no content
$subRequest -> headers -> remove ( 'If-Modified-Since' );
$subRequest -> headers -> remove ( 'If-None-Match' );
$response = $this -> forward ( $subRequest , $catch );
if ( $response -> isCacheable ()) {
$this -> store ( $request , $response );
}
}
if ( null === $entry ) {
$this -> record ( $request , 'miss' );
return $this -> fetch ( $request , $catch );
}
if (! $this -> isFreshEnough ( $request , $entry )) {
$this -> record ( $request , 'stale' );
reload the cache by fetching a fresh response and caching it (if possible).
*/
$this -> record ( $request , 'reload' );
$response = $this -> fetch ( $request , $catch );
} else {
$response = $this -> lookup ( $request , $catch );
}
$this -> restoreResponseBody ( $request , $response );
if ( HttpKernelInterface :: MAIN_REQUEST === $type ) {
{
if (! $this -> booted ) {
$container = $this -> container ?? $this -> preBoot ();
if ( $container -> has ( 'http_cache' )) {
return $container -> get ( 'http_cache' )-> handle ( $request , $type , $catch );
}
}
$this -> boot ();
++ $this -> requestStackSize ;
$this -> request = $request ;
}
public function run (): int
{
$response = $this -> kernel -> handle ( $this -> request );
$response -> send ();
if ( $this -> kernel instanceof TerminableInterface ) {
$this -> kernel -> terminate ( $this -> request , $response );
}
$app = $app (... $args );
exit(
$runtime
-> getRunner ( $app )
-> run ()
);
<?php
use App\Kernel ;
require_once dirname ( __DIR__ ). '/vendor/autoload_runtime.php' ;
return function (array $context ) {
return new Kernel ( $context [ 'APP_ENV' ], (bool) $context [ 'APP_DEBUG' ]);
};
PDOException
could not find driver
string $username ,
string $password ,
array $options
): PDO {
if ( PHP_VERSION_ID < 80400 ) {
return new PDO ( $dsn , $username , $password , $options );
}
return PDO :: connect ( $dsn , $username , $password , $options );
}
}
string $username ,
string $password ,
array $options
): PDO {
if ( PHP_VERSION_ID < 80400 ) {
return new PDO ( $dsn , $username , $password , $options );
}
return PDO :: connect ( $dsn , $username , $password , $options );
}
}
$safeParams = $params ;
unset( $safeParams [ 'password' ], $safeParams [ 'url' ]);
try {
$pdo = $this -> doConnect (
$this -> constructPdoDsn ( $safeParams ),
$params [ 'user' ] ?? '' ,
$params [ 'password' ] ?? '' ,
$driverOptions ,
);
*/
public function connect (
#[ SensitiveParameter ]
array $params
) {
return $this -> wrappedDriver -> connect ( $params );
}
/**
* {@inheritDoc}
*/
}
public function connect (array $params ): Connection
{
return new Connection (
parent :: connect ( $params ),
$this -> debugDataHolder ,
$this -> stopwatch ,
$this -> connectionName
);
}
if ( $this -> _conn !== null ) {
return false ;
}
try {
$this -> _conn = $this -> _driver -> connect ( $this -> params );
} catch ( Driver\Exception $e ) {
throw $this -> convertException ( $e );
}
if ( $this -> autoCommit === false ) {
}
// If not connected, we need to connect now to determine the platform version.
if ( $this -> _conn === null ) {
try {
$this -> connect ();
} catch ( Exception $originalException ) {
if (! isset( $this -> params [ 'dbname' ])) {
throw $originalException ;
}
*
* @throws Exception If an invalid platform was specified for this connection.
*/
private function detectDatabasePlatform (): AbstractPlatform
{
$version = $this -> getDatabasePlatformVersion ();
if ( $version !== null ) {
assert ( $this -> _driver instanceof VersionAwarePlatformDriver );
return $this -> _driver -> createDatabasePlatformForVersion ( $version );
* @throws Exception
*/
public function getDatabasePlatform ()
{
if ( $this -> platform === null ) {
$this -> platform = $this -> detectDatabasePlatform ();
$this -> platform -> setEventManager ( $this -> _eventManager );
$this -> platform -> setDisableTypeComments ( $this -> _config -> getDisableTypeComments ());
}
return $this -> platform ;
}
private function getTargetPlatform (): Platforms\AbstractPlatform
{
if (! $this -> targetPlatform ) {
$this -> targetPlatform = $this -> em -> getConnection ()-> getDatabasePlatform ();
}
return $this -> targetPlatform ;
}
}
*/
private function completeIdGeneratorMapping ( ClassMetadataInfo $class ): void
{
$idGenType = $class -> generatorType ;
if ( $idGenType === ClassMetadata :: GENERATOR_TYPE_AUTO ) {
$class -> setIdGeneratorType ( $this -> determineIdGeneratorStrategy ( $this -> getTargetPlatform ()));
}
// Create & assign an appropriate ID generator instance
switch ( $class -> generatorType ) {
case ClassMetadata :: GENERATOR_TYPE_IDENTITY :
// However this is only true if the hierarchy of parents contains the root entity,
// if it consists of mapped superclasses these don't necessarily include the id field.
if ( $parent && $rootEntityFound ) {
$this -> inheritIdGeneratorMapping ( $class , $parent );
} else {
$this -> completeIdGeneratorMapping ( $class );
}
if (! $class -> isMappedSuperclass ) {
if ( $rootEntityFound && $class -> isInheritanceTypeNone ()) {
Deprecation :: trigger (
/**
* {@inheritDoc}
*/
protected function doLoadMetadata ( $class , $parent , $rootEntityFound , array $nonSuperclassParents ): void
{
parent :: doLoadMetadata ( $class , $parent , $rootEntityFound , $nonSuperclassParents );
$customGeneratorDefinition = $class -> customGeneratorDefinition ;
if (! isset( $customGeneratorDefinition [ 'instance' ])) {
return;
}
$class = $this -> newClassMetadataInstance ( $className );
$this -> initializeReflection ( $class , $reflService );
$this -> doLoadMetadata ( $class , $parent , $rootEntityFound , $visited );
$this -> loadedMetadata [ $className ] = $class ;
$parent = $class ;
/** @phpstan-var CMTemplate $cached */
$this -> loadedMetadata [ $realClassName ] = $cached ;
$this -> wakeupReflection ( $cached , $this -> getReflectionService ());
} else {
$loadedMetadata = $this -> loadMetadata ( $realClassName );
$classNames = array_combine (
array_map ([ $this , 'getCacheKey' ], $loadedMetadata ),
$loadedMetadata
);
*
* {@inheritDoc}
*/
public function getClassMetadata ( $className )
{
return $this -> metadataFactory -> getMetadataFor ( $className );
}
/**
* {@inheritDoc}
*/
*
* @template T of object
*/
private function doGetRepository ( EntityManagerInterface $entityManager , string $entityName , bool $strictTypeCheck ): ObjectRepository
{
$metadata = $entityManager -> getClassMetadata ( $entityName );
$repositoryServiceId = $metadata -> customRepositoryClassName ;
$customRepositoryName = $metadata -> customRepositoryClassName ;
if ( $customRepositoryName !== null ) {
// fetch from the container
trait RepositoryFactoryCompatibility
{
/** {@inheritDoc} */
public function getRepository ( EntityManagerInterface $entityManager , $entityName ): ObjectRepository
{
return $this -> doGetRepository ( $entityManager , $entityName , false );
}
}
}
__METHOD__
));
}
}
$repository = $this -> repositoryFactory -> getRepository ( $this , $entityName );
if (! $repository instanceof EntityRepository ) {
Deprecation :: trigger (
'doctrine/orm' ,
'https://github.com/doctrine/orm/pull/9533' ,
'Not returning an instance of %s from %s::getRepository() is deprecated and will cause a TypeError on 3.0.' ,
public function getRepository ( $entityName )
{
$this -> initializera9f5f && ( $this -> initializera9f5f -> __invoke ( $valueHolder5d3a2 , $this , 'getRepository' , array( 'entityName' => $entityName ), $this -> initializera9f5f ) || 1 ) && $this -> valueHolder5d3a2 = $valueHolder5d3a2 ;
return $this -> valueHolder5d3a2 -> getRepository ( $entityName );
}
public function contains ( $entity )
{
$this -> initializera9f5f && ( $this -> initializera9f5f -> __invoke ( $valueHolder5d3a2 , $this , 'contains' , array( 'entity' => $entity ), $this -> initializera9f5f ) || 1 ) && $this -> valueHolder5d3a2 = $valueHolder5d3a2 ;
$this -> em = $em ;
$this -> Auth = $Auth ;
$this -> Auth -> setUser ( $security -> getUser ());
$this -> ModelOrder = $ModelOrder ;
$this -> Users = $this -> em -> getRepository ( User ::class);
$this -> Discounts = $this -> em -> getRepository ( Discount ::class);
}
/**
* Если пользователь не залогинен возаращает 0.
if (isset( $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ])) {
return $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ];
}
return $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ] = new \App\Service\Discount\UserDiscount ( $a , $b , $c , $d );
}
/**
* Gets the private 'App\Service\Filter\Cats' shared autowired service.
*
*
* @return \App\Model\Prod
*/
protected function getProdService ()
{
$a = ( $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ] ?? $this -> getUserDiscountService ());
if (isset( $this -> privates [ 'App\\Model\\Prod' ])) {
return $this -> privates [ 'App\\Model\\Prod' ];
}
*
* @return \App\Repository\ProdRepository
*/
protected function getProdRepositoryService ()
{
$a = ( $this -> privates [ 'App\\Model\\Prod' ] ?? $this -> getProdService ());
if (isset( $this -> privates [ 'App\\Repository\\ProdRepository' ])) {
return $this -> privates [ 'App\\Repository\\ProdRepository' ];
}
*
* @return \App\Model\Wishlist
*/
protected function getWishlistService ()
{
$a = ( $this -> privates [ 'App\\Repository\\ProdRepository' ] ?? $this -> getProdRepositoryService ());
if (isset( $this -> privates [ 'App\\Model\\Wishlist' ])) {
return $this -> privates [ 'App\\Model\\Wishlist' ];
}
$b = ( $this -> privates [ 'App\\Model\\Prod' ] ?? $this -> getProdService ());
if (isset( $this -> privates [ 'App\\EventSubscriber\\Redirect' ])) {
return $this -> privates [ 'App\\EventSubscriber\\Redirect' ];
}
return $this -> privates [ 'App\\EventSubscriber\\Redirect' ] = new \App\EventSubscriber\Redirect (( $this -> privates [ 'App\\DTO\\AppDTO' ] ?? ( $this -> privates [ 'App\\DTO\\AppDTO' ] = new \App\DTO\AppDTO ())), $a , $b , ( $this -> privates [ '.app_cache.taggable' ] ?? $this -> get_AppCache_TaggableService ()), $c , ( $this -> privates [ 'App\\Env' ] ?? ( $this -> privates [ 'App\\Env' ] = new \App\Env (( $this -> services [ 'kernel' ] ?? $this -> get ( 'kernel' , 1 ))))), ( $this -> privates [ 'App\\Func' ] ?? ( $this -> privates [ 'App\\Func' ] = new \App\Func ())), ( $this -> privates [ 'App\\Model\\Wishlist' ] ?? $this -> getWishlistService ()), $d , ( $this -> privates [ 'App\\Repository\\RedirectRepository' ] ?? $this -> getRedirectRepositoryService ()));
}
/**
* Gets the private 'App\EventSubscriber\RedirectLocale' shared autowired service.
*
}, 1 => 'onLoginSuccessEvent' ], 0 );
$instance -> addListener ( 'app.order.payed' , [ 0 => function () {
return ( $this -> privates [ 'App\\EventSubscriber\\PrzlelewyOrderPayed' ] ?? $this -> load ( 'getPrzlelewyOrderPayedService' ));
}, 1 => 'onOrderPayed' ], 0 );
$instance -> addListener ( 'kernel.request' , [ 0 => function () {
return ( $this -> privates [ 'App\\EventSubscriber\\Redirect' ] ?? $this -> getRedirectService ());
}, 1 => 'onRequest' ], 0 );
$instance -> addListener ( 'kernel.request' , [ 0 => function () {
return ( $this -> privates [ 'App\\EventSubscriber\\RedirectLocale' ] ?? $this -> getRedirectLocaleService ());
}, 1 => 'onKernelController' ], 0 );
$instance -> addListener ( 'app.order.maked' , [ 0 => function () {
}
foreach ( $this -> listeners [ $eventName ] as $priority => & $listeners ) {
foreach ( $listeners as $k => & $v ) {
if ( $v !== $listener && \is_array ( $v ) && isset( $v [ 0 ]) && $v [ 0 ] instanceof \Closure && 2 >= \count ( $v )) {
$v [ 0 ] = $v [ 0 ]();
$v [ 1 ] = $v [ 1 ] ?? '__invoke' ;
}
if ( $v === $listener || ( $listener instanceof \Closure && $v == $listener )) {
unset( $listeners [ $k ], $this -> sorted [ $eventName ], $this -> optimized [ $eventName ]);
}
foreach ( $this -> dispatcher -> getListeners ( $eventName ) as $listener ) {
$priority = $this -> getListenerPriority ( $eventName , $listener );
$wrappedListener = new WrappedListener ( $listener instanceof WrappedListener ? $listener -> getWrappedListener () : $listener , null , $this -> stopwatch , $this );
$this -> wrappedListeners [ $eventName ][] = $wrappedListener ;
$this -> dispatcher -> removeListener ( $eventName , $listener );
$this -> dispatcher -> addListener ( $eventName , $wrappedListener , $priority );
$this -> callStack -> attach ( $wrappedListener , [ $eventName , $this -> currentRequestHash ]);
}
}
if ( null !== $this -> logger && $event instanceof StoppableEventInterface && $event -> isPropagationStopped ()) {
$this -> logger -> debug ( sprintf ( 'The "%s" event is already stopped. No listeners have been called.' , $eventName ));
}
$this -> preProcess ( $eventName );
try {
$this -> beforeDispatch ( $eventName , $event );
try {
$e = $this -> stopwatch -> start ( $eventName , 'section' );
try {
*/
private function handleRaw ( Request $request , int $type = self :: MAIN_REQUEST ): Response
{
// request
$event = new RequestEvent ( $this , $request , $type );
$this -> dispatcher -> dispatch ( $event , KernelEvents :: REQUEST );
if ( $event -> hasResponse ()) {
return $this -> filterResponse ( $event -> getResponse (), $request , $type );
}
{
$request -> headers -> set ( 'X-Php-Ob-Level' , (string) ob_get_level ());
$this -> requestStack -> push ( $request );
try {
return $this -> handleRaw ( $request , $type );
} catch ( \Exception $e ) {
if ( $e instanceof RequestExceptionInterface ) {
$e = new BadRequestHttpException ( $e -> getMessage (), $e );
}
if ( false === $catch ) {
$throwable = $event -> getThrowable ();
$request = $this -> duplicateRequest ( $throwable , $event -> getRequest ());
try {
$response = $event -> getKernel ()-> handle ( $request , HttpKernelInterface :: SUB_REQUEST , false );
} catch ( \Exception $e ) {
$f = FlattenException :: createFromThrowable ( $e );
$this -> logException ( $e , sprintf ( 'Exception thrown when handling an exception (%s: %s at %s line %s)' , $f -> getClass (), $f -> getMessage (), $e -> getFile (), $e -> getLine ()));
$this -> called = true ;
$this -> priority = $dispatcher -> getListenerPriority ( $eventName , $this -> listener );
$e = $this -> stopwatch -> start ( $this -> name , 'event_listener' );
( $this -> optimizedListener ?? $this -> listener )( $event , $eventName , $dispatcher );
if ( $e -> isStarted ()) {
$e -> stop ();
}
foreach ( $listeners as $listener ) {
if ( $stoppable && $event -> isPropagationStopped ()) {
break;
}
$listener ( $event , $eventName , $this );
}
}
/**
* Sorts the internal list of listeners for the given event by priority.
} else {
$listeners = $this -> getListeners ( $eventName );
}
if ( $listeners ) {
$this -> callListeners ( $listeners , $eventName , $event );
}
return $event ;
}
try {
$this -> beforeDispatch ( $eventName , $event );
try {
$e = $this -> stopwatch -> start ( $eventName , 'section' );
try {
$this -> dispatcher -> dispatch ( $event , $eventName );
} finally {
if ( $e -> isStarted ()) {
$e -> stop ();
}
}
* @throws \Exception
*/
private function handleThrowable ( \Throwable $e , Request $request , int $type ): Response
{
$event = new ExceptionEvent ( $this , $request , $type , $e );
$this -> dispatcher -> dispatch ( $event , KernelEvents :: EXCEPTION );
// a listener might have replaced the exception
$e = $event -> getThrowable ();
if (! $event -> hasResponse ()) {
$this -> finishRequest ( $request , $type );
throw $e ;
}
return $this -> handleThrowable ( $e , $request , $type );
} finally {
$this -> requestStack -> pop ();
}
}
$this -> boot ();
++ $this -> requestStackSize ;
$this -> resetServices = true ;
try {
return $this -> getHttpKernel ()-> handle ( $request , $type , $catch );
} finally {
-- $this -> requestStackSize ;
}
}
if (! IpUtils :: checkIp ( '127.0.0.1' , $trustedProxies )) {
Request :: setTrustedProxies ( array_merge ( $trustedProxies , [ '127.0.0.1' ]), Request :: getTrustedHeaderSet ());
}
try {
return $kernel -> handle ( $request , $type , $catch );
} finally {
// restore global state
Request :: setTrustedProxies ( $trustedProxies , $trustedHeaderSet );
}
}
if ( $this -> surrogate ) {
$this -> surrogate -> addSurrogateCapability ( $request );
}
// always a "master" request (as the real master request can be in cache)
$response = SubRequestHandler :: handle ( $this -> kernel , $request , HttpKernelInterface :: MAIN_REQUEST , $catch );
/*
* Support stale-if-error given on Responses or as a config option.
* RFC 7234 summarizes in Section 4.2.4 (but also mentions with the individual
* Cache-Control directives) that
protected function forward ( Request $request , bool $catch = false , Response $entry = null ): Response
{
$this -> getKernel ()-> boot ();
$this -> getKernel ()-> getContainer ()-> set ( 'cache' , $this );
return parent :: forward ( $request , $catch , $entry );
}
/**
* Returns an array of options to customize the Cache configuration.
*/
// avoid that the backend sends no content
$subRequest -> headers -> remove ( 'If-Modified-Since' );
$subRequest -> headers -> remove ( 'If-None-Match' );
$response = $this -> forward ( $subRequest , $catch );
if ( $response -> isCacheable ()) {
$this -> store ( $request , $response );
}
}
if ( null === $entry ) {
$this -> record ( $request , 'miss' );
return $this -> fetch ( $request , $catch );
}
if (! $this -> isFreshEnough ( $request , $entry )) {
$this -> record ( $request , 'stale' );
reload the cache by fetching a fresh response and caching it (if possible).
*/
$this -> record ( $request , 'reload' );
$response = $this -> fetch ( $request , $catch );
} else {
$response = $this -> lookup ( $request , $catch );
}
$this -> restoreResponseBody ( $request , $response );
if ( HttpKernelInterface :: MAIN_REQUEST === $type ) {
{
if (! $this -> booted ) {
$container = $this -> container ?? $this -> preBoot ();
if ( $container -> has ( 'http_cache' )) {
return $container -> get ( 'http_cache' )-> handle ( $request , $type , $catch );
}
}
$this -> boot ();
++ $this -> requestStackSize ;
$this -> request = $request ;
}
public function run (): int
{
$response = $this -> kernel -> handle ( $this -> request );
$response -> send ();
if ( $this -> kernel instanceof TerminableInterface ) {
$this -> kernel -> terminate ( $this -> request , $response );
}
$app = $app (... $args );
exit(
$runtime
-> getRunner ( $app )
-> run ()
);
<?php
use App\Kernel ;
require_once dirname ( __DIR__ ). '/vendor/autoload_runtime.php' ;
return function (array $context ) {
return new Kernel ( $context [ 'APP_ENV' ], (bool) $context [ 'APP_DEBUG' ]);
};
Doctrine\DBAL\Exception\
DriverException
An exception occurred in the driver: could not find driver
case 1364 :
case 1566 :
return new NotNullConstraintViolationException ( $exception , $query );
}
return new DriverException ( $exception , $query );
}
}
private function handleDriverException (
Driver\Exception $driverException ,
? Query $query
): DriverException {
$this -> exceptionConverter ??= $this -> _driver -> getExceptionConverter ();
$exception = $this -> exceptionConverter -> convert ( $driverException , $query );
if ( $exception instanceof ConnectionLost ) {
$this -> close ();
}
}
/** @internal */
final public function convertException ( Driver\Exception $e ): DriverException
{
return $this -> handleDriverException ( $e , null );
}
/**
* @param array<int, mixed>|array<string, mixed> $params
* @param array<int, int|string|Type|null>|array<string, int|string|Type|null> $types
}
try {
$this -> _conn = $this -> _driver -> connect ( $this -> params );
} catch ( Driver\Exception $e ) {
throw $this -> convertException ( $e );
}
if ( $this -> autoCommit === false ) {
$this -> beginTransaction ();
}
}
// If not connected, we need to connect now to determine the platform version.
if ( $this -> _conn === null ) {
try {
$this -> connect ();
} catch ( Exception $originalException ) {
if (! isset( $this -> params [ 'dbname' ])) {
throw $originalException ;
}
*
* @throws Exception If an invalid platform was specified for this connection.
*/
private function detectDatabasePlatform (): AbstractPlatform
{
$version = $this -> getDatabasePlatformVersion ();
if ( $version !== null ) {
assert ( $this -> _driver instanceof VersionAwarePlatformDriver );
return $this -> _driver -> createDatabasePlatformForVersion ( $version );
* @throws Exception
*/
public function getDatabasePlatform ()
{
if ( $this -> platform === null ) {
$this -> platform = $this -> detectDatabasePlatform ();
$this -> platform -> setEventManager ( $this -> _eventManager );
$this -> platform -> setDisableTypeComments ( $this -> _config -> getDisableTypeComments ());
}
return $this -> platform ;
}
private function getTargetPlatform (): Platforms\AbstractPlatform
{
if (! $this -> targetPlatform ) {
$this -> targetPlatform = $this -> em -> getConnection ()-> getDatabasePlatform ();
}
return $this -> targetPlatform ;
}
}
*/
private function completeIdGeneratorMapping ( ClassMetadataInfo $class ): void
{
$idGenType = $class -> generatorType ;
if ( $idGenType === ClassMetadata :: GENERATOR_TYPE_AUTO ) {
$class -> setIdGeneratorType ( $this -> determineIdGeneratorStrategy ( $this -> getTargetPlatform ()));
}
// Create & assign an appropriate ID generator instance
switch ( $class -> generatorType ) {
case ClassMetadata :: GENERATOR_TYPE_IDENTITY :
// However this is only true if the hierarchy of parents contains the root entity,
// if it consists of mapped superclasses these don't necessarily include the id field.
if ( $parent && $rootEntityFound ) {
$this -> inheritIdGeneratorMapping ( $class , $parent );
} else {
$this -> completeIdGeneratorMapping ( $class );
}
if (! $class -> isMappedSuperclass ) {
if ( $rootEntityFound && $class -> isInheritanceTypeNone ()) {
Deprecation :: trigger (
/**
* {@inheritDoc}
*/
protected function doLoadMetadata ( $class , $parent , $rootEntityFound , array $nonSuperclassParents ): void
{
parent :: doLoadMetadata ( $class , $parent , $rootEntityFound , $nonSuperclassParents );
$customGeneratorDefinition = $class -> customGeneratorDefinition ;
if (! isset( $customGeneratorDefinition [ 'instance' ])) {
return;
}
$class = $this -> newClassMetadataInstance ( $className );
$this -> initializeReflection ( $class , $reflService );
$this -> doLoadMetadata ( $class , $parent , $rootEntityFound , $visited );
$this -> loadedMetadata [ $className ] = $class ;
$parent = $class ;
/** @phpstan-var CMTemplate $cached */
$this -> loadedMetadata [ $realClassName ] = $cached ;
$this -> wakeupReflection ( $cached , $this -> getReflectionService ());
} else {
$loadedMetadata = $this -> loadMetadata ( $realClassName );
$classNames = array_combine (
array_map ([ $this , 'getCacheKey' ], $loadedMetadata ),
$loadedMetadata
);
*
* {@inheritDoc}
*/
public function getClassMetadata ( $className )
{
return $this -> metadataFactory -> getMetadataFor ( $className );
}
/**
* {@inheritDoc}
*/
*
* @template T of object
*/
private function doGetRepository ( EntityManagerInterface $entityManager , string $entityName , bool $strictTypeCheck ): ObjectRepository
{
$metadata = $entityManager -> getClassMetadata ( $entityName );
$repositoryServiceId = $metadata -> customRepositoryClassName ;
$customRepositoryName = $metadata -> customRepositoryClassName ;
if ( $customRepositoryName !== null ) {
// fetch from the container
trait RepositoryFactoryCompatibility
{
/** {@inheritDoc} */
public function getRepository ( EntityManagerInterface $entityManager , $entityName ): ObjectRepository
{
return $this -> doGetRepository ( $entityManager , $entityName , false );
}
}
}
__METHOD__
));
}
}
$repository = $this -> repositoryFactory -> getRepository ( $this , $entityName );
if (! $repository instanceof EntityRepository ) {
Deprecation :: trigger (
'doctrine/orm' ,
'https://github.com/doctrine/orm/pull/9533' ,
'Not returning an instance of %s from %s::getRepository() is deprecated and will cause a TypeError on 3.0.' ,
public function getRepository ( $entityName )
{
$this -> initializera9f5f && ( $this -> initializera9f5f -> __invoke ( $valueHolder5d3a2 , $this , 'getRepository' , array( 'entityName' => $entityName ), $this -> initializera9f5f ) || 1 ) && $this -> valueHolder5d3a2 = $valueHolder5d3a2 ;
return $this -> valueHolder5d3a2 -> getRepository ( $entityName );
}
public function contains ( $entity )
{
$this -> initializera9f5f && ( $this -> initializera9f5f -> __invoke ( $valueHolder5d3a2 , $this , 'contains' , array( 'entity' => $entity ), $this -> initializera9f5f ) || 1 ) && $this -> valueHolder5d3a2 = $valueHolder5d3a2 ;
$this -> em = $em ;
$this -> Auth = $Auth ;
$this -> Auth -> setUser ( $security -> getUser ());
$this -> ModelOrder = $ModelOrder ;
$this -> Users = $this -> em -> getRepository ( User ::class);
$this -> Discounts = $this -> em -> getRepository ( Discount ::class);
}
/**
* Если пользователь не залогинен возаращает 0.
if (isset( $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ])) {
return $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ];
}
return $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ] = new \App\Service\Discount\UserDiscount ( $a , $b , $c , $d );
}
/**
* Gets the private 'App\Service\Filter\Cats' shared autowired service.
*
*
* @return \App\Model\Prod
*/
protected function getProdService ()
{
$a = ( $this -> privates [ 'App\\Service\\Discount\\UserDiscount' ] ?? $this -> getUserDiscountService ());
if (isset( $this -> privates [ 'App\\Model\\Prod' ])) {
return $this -> privates [ 'App\\Model\\Prod' ];
}
*
* @return \App\Repository\ProdRepository
*/
protected function getProdRepositoryService ()
{
$a = ( $this -> privates [ 'App\\Model\\Prod' ] ?? $this -> getProdService ());
if (isset( $this -> privates [ 'App\\Repository\\ProdRepository' ])) {
return $this -> privates [ 'App\\Repository\\ProdRepository' ];
}
*
* @return \App\Model\Wishlist
*/
protected function getWishlistService ()
{
$a = ( $this -> privates [ 'App\\Repository\\ProdRepository' ] ?? $this -> getProdRepositoryService ());
if (isset( $this -> privates [ 'App\\Model\\Wishlist' ])) {
return $this -> privates [ 'App\\Model\\Wishlist' ];
}
$b = ( $this -> privates [ 'App\\Model\\Prod' ] ?? $this -> getProdService ());
if (isset( $this -> privates [ 'App\\EventSubscriber\\Redirect' ])) {
return $this -> privates [ 'App\\EventSubscriber\\Redirect' ];
}
return $this -> privates [ 'App\\EventSubscriber\\Redirect' ] = new \App\EventSubscriber\Redirect (( $this -> privates [ 'App\\DTO\\AppDTO' ] ?? ( $this -> privates [ 'App\\DTO\\AppDTO' ] = new \App\DTO\AppDTO ())), $a , $b , ( $this -> privates [ '.app_cache.taggable' ] ?? $this -> get_AppCache_TaggableService ()), $c , ( $this -> privates [ 'App\\Env' ] ?? ( $this -> privates [ 'App\\Env' ] = new \App\Env (( $this -> services [ 'kernel' ] ?? $this -> get ( 'kernel' , 1 ))))), ( $this -> privates [ 'App\\Func' ] ?? ( $this -> privates [ 'App\\Func' ] = new \App\Func ())), ( $this -> privates [ 'App\\Model\\Wishlist' ] ?? $this -> getWishlistService ()), $d , ( $this -> privates [ 'App\\Repository\\RedirectRepository' ] ?? $this -> getRedirectRepositoryService ()));
}
/**
* Gets the private 'App\EventSubscriber\RedirectLocale' shared autowired service.
*
}, 1 => 'onLoginSuccessEvent' ], 0 );
$instance -> addListener ( 'app.order.payed' , [ 0 => function () {
return ( $this -> privates [ 'App\\EventSubscriber\\PrzlelewyOrderPayed' ] ?? $this -> load ( 'getPrzlelewyOrderPayedService' ));
}, 1 => 'onOrderPayed' ], 0 );
$instance -> addListener ( 'kernel.request' , [ 0 => function () {
return ( $this -> privates [ 'App\\EventSubscriber\\Redirect' ] ?? $this -> getRedirectService ());
}, 1 => 'onRequest' ], 0 );
$instance -> addListener ( 'kernel.request' , [ 0 => function () {
return ( $this -> privates [ 'App\\EventSubscriber\\RedirectLocale' ] ?? $this -> getRedirectLocaleService ());
}, 1 => 'onKernelController' ], 0 );
$instance -> addListener ( 'app.order.maked' , [ 0 => function () {
$this -> sorted [ $eventName ] = [];
foreach ( $this -> listeners [ $eventName ] as & $listeners ) {
foreach ( $listeners as $k => & $listener ) {
if ( \is_array ( $listener ) && isset( $listener [ 0 ]) && $listener [ 0 ] instanceof \Closure && 2 >= \count ( $listener )) {
$listener [ 0 ] = $listener [ 0 ]();
$listener [ 1 ] = $listener [ 1 ] ?? '__invoke' ;
}
$this -> sorted [ $eventName ][] = $listener ;
}
}
if (empty( $this -> listeners [ $eventName ])) {
return [];
}
if (!isset( $this -> sorted [ $eventName ])) {
$this -> sortListeners ( $eventName );
}
return $this -> sorted [ $eventName ];
}
$this -> orphanedEvents [ $this -> currentRequestHash ][] = $eventName ;
return;
}
foreach ( $this -> dispatcher -> getListeners ( $eventName ) as $listener ) {
$priority = $this -> getListenerPriority ( $eventName , $listener );
$wrappedListener = new WrappedListener ( $listener instanceof WrappedListener ? $listener -> getWrappedListener () : $listener , null , $this -> stopwatch , $this );
$this -> wrappedListeners [ $eventName ][] = $wrappedListener ;
$this -> dispatcher -> removeListener ( $eventName , $listener );
$this -> dispatcher -> addListener ( $eventName , $wrappedListener , $priority );
if ( null !== $this -> logger && $event instanceof StoppableEventInterface && $event -> isPropagationStopped ()) {
$this -> logger -> debug ( sprintf ( 'The "%s" event is already stopped. No listeners have been called.' , $eventName ));
}
$this -> preProcess ( $eventName );
try {
$this -> beforeDispatch ( $eventName , $event );
try {
$e = $this -> stopwatch -> start ( $eventName , 'section' );
try {
*/
private function handleRaw ( Request $request , int $type = self :: MAIN_REQUEST ): Response
{
// request
$event = new RequestEvent ( $this , $request , $type );
$this -> dispatcher -> dispatch ( $event , KernelEvents :: REQUEST );
if ( $event -> hasResponse ()) {
return $this -> filterResponse ( $event -> getResponse (), $request , $type );
}
{
$request -> headers -> set ( 'X-Php-Ob-Level' , (string) ob_get_level ());
$this -> requestStack -> push ( $request );
try {
return $this -> handleRaw ( $request , $type );
} catch ( \Exception $e ) {
if ( $e instanceof RequestExceptionInterface ) {
$e = new BadRequestHttpException ( $e -> getMessage (), $e );
}
if ( false === $catch ) {
$this -> boot ();
++ $this -> requestStackSize ;
$this -> resetServices = true ;
try {
return $this -> getHttpKernel ()-> handle ( $request , $type , $catch );
} finally {
-- $this -> requestStackSize ;
}
}
if (! IpUtils :: checkIp ( '127.0.0.1' , $trustedProxies )) {
Request :: setTrustedProxies ( array_merge ( $trustedProxies , [ '127.0.0.1' ]), Request :: getTrustedHeaderSet ());
}
try {
return $kernel -> handle ( $request , $type , $catch );
} finally {
// restore global state
Request :: setTrustedProxies ( $trustedProxies , $trustedHeaderSet );
}
}
if ( $this -> surrogate ) {
$this -> surrogate -> addSurrogateCapability ( $request );
}
// always a "master" request (as the real master request can be in cache)
$response = SubRequestHandler :: handle ( $this -> kernel , $request , HttpKernelInterface :: MAIN_REQUEST , $catch );
/*
* Support stale-if-error given on Responses or as a config option.
* RFC 7234 summarizes in Section 4.2.4 (but also mentions with the individual
* Cache-Control directives) that
protected function forward ( Request $request , bool $catch = false , Response $entry = null ): Response
{
$this -> getKernel ()-> boot ();
$this -> getKernel ()-> getContainer ()-> set ( 'cache' , $this );
return parent :: forward ( $request , $catch , $entry );
}
/**
* Returns an array of options to customize the Cache configuration.
*/
// avoid that the backend sends no content
$subRequest -> headers -> remove ( 'If-Modified-Since' );
$subRequest -> headers -> remove ( 'If-None-Match' );
$response = $this -> forward ( $subRequest , $catch );
if ( $response -> isCacheable ()) {
$this -> store ( $request , $response );
}
}
if ( null === $entry ) {
$this -> record ( $request , 'miss' );
return $this -> fetch ( $request , $catch );
}
if (! $this -> isFreshEnough ( $request , $entry )) {
$this -> record ( $request , 'stale' );
reload the cache by fetching a fresh response and caching it (if possible).
*/
$this -> record ( $request , 'reload' );
$response = $this -> fetch ( $request , $catch );
} else {
$response = $this -> lookup ( $request , $catch );
}
$this -> restoreResponseBody ( $request , $response );
if ( HttpKernelInterface :: MAIN_REQUEST === $type ) {
{
if (! $this -> booted ) {
$container = $this -> container ?? $this -> preBoot ();
if ( $container -> has ( 'http_cache' )) {
return $container -> get ( 'http_cache' )-> handle ( $request , $type , $catch );
}
}
$this -> boot ();
++ $this -> requestStackSize ;
$this -> request = $request ;
}
public function run (): int
{
$response = $this -> kernel -> handle ( $this -> request );
$response -> send ();
if ( $this -> kernel instanceof TerminableInterface ) {
$this -> kernel -> terminate ( $this -> request , $response );
}
$app = $app (... $args );
exit(
$runtime
-> getRunner ( $app )
-> run ()
);
<?php
use App\Kernel ;
require_once dirname ( __DIR__ ). '/vendor/autoload_runtime.php' ;
return function (array $context ) {
return new Kernel ( $context [ 'APP_ENV' ], (bool) $context [ 'APP_DEBUG' ]);
};
Fatal error : Uncaught ErrorException: Warning: include(/home/dombusin.com/public_html/vendor/symfony/error-handler/Resources/views/traces.html.php): Failed to open stream: Too many open files in system in /home/dombusin.com/public_html/vendor/symfony/error-handler/ErrorRenderer/HtmlErrorRenderer.php:336
Stack trace:
#0 /home/dombusin.com/public_html/vendor/symfony/error-handler/ErrorRenderer/HtmlErrorRenderer.php(336): include()
#1 /home/dombusin.com/public_html/vendor/symfony/error-handler/Resources/views/exception.html.php(55): Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer->include('views/traces.ht...', Array)
#2 /home/dombusin.com/public_html/vendor/symfony/error-handler/ErrorRenderer/HtmlErrorRenderer.php(336): include('/home/dombusin....')
#3 /home/dombusin.com/public_html/vendor/symfony/error-handler/Resources/views/exception_full.html.php(35): Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer->include('views/exception...', Array)
#4 /home/dombusin.com/public_html/vendor/symfony/error-handler/ErrorRenderer/HtmlErrorRenderer.php(336): include('/home/dombusin....')
#5 /home/dombusin.com/public_html/vendor/symfony/error-handler/ErrorRenderer/HtmlErrorRenderer.php(140): Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer->include('views/exception...', Array)
#6 /home/dombusin.com/public_html/vendor/symfony/error-handler/ErrorRenderer/HtmlErrorRenderer.php(72): Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer->renderException(Object(Symfony\Component\ErrorHandler\Exception\FlattenException))
#7 /home/dombusin.com/public_html/vendor/symfony/error-handler/ErrorHandler.php(653): Symfony\Component\ErrorHandler\ErrorRenderer\HtmlErrorRenderer->render(Object(Symfony\Component\ErrorHandler\Exception\FlattenException))
#8 /home/dombusin.com/public_html/vendor/symfony/error-handler/ErrorHandler.php(541): Symfony\Component\ErrorHandler\ErrorHandler->renderException(Object(Doctrine\DBAL\Exception\DriverException))
#9 [internal function]: Symfony\Component\ErrorHandler\ErrorHandler->handleException(Object(Doctrine\DBAL\Exception\DriverException))
#10 {main}
thrown in
/home/dombusin.com/public_html/vendor/symfony/error-handler/ErrorRenderer/HtmlErrorRenderer.php on line
336