idx
int64
0
241k
question
stringlengths
64
6.21k
target
stringlengths
5
803
3,500
private function getEnabled ( array $ context , string $ resourceClass = null , string $ operationName = null , bool $ partial = false ) : bool { $ enabled = $ this -> options [ $ partial ? 'partial' : 'enabled' ] ; $ clientEnabled = $ this -> options [ $ partial ? 'client_partial' : 'client_enabled' ] ; if ( null !== ...
Is the classic or partial pagination enabled?
3,501
private function getParameterFromContext ( array $ context , string $ parameterName , $ default = null ) { $ filters = $ context [ 'filters' ] ?? [ ] ; return \ array_key_exists ( $ parameterName , $ filters ) ? $ filters [ $ parameterName ] : $ default ; }
Gets the given pagination parameter name from the given context .
3,502
public function createFilterCollectionFromLocator ( ContainerInterface $ filterLocator ) : FilterCollection { $ filters = [ ] ; foreach ( $ this -> filtersIds as $ filterId ) { if ( $ filterLocator -> has ( $ filterId ) ) { $ filters [ $ filterId ] = $ filterLocator -> get ( $ filterId ) ; } } return new FilterCollecti...
Creates a filter collection from a filter locator .
3,503
private function setFilterLocator ( $ filterLocator , bool $ allowNull = false ) : void { if ( $ filterLocator instanceof ContainerInterface || $ filterLocator instanceof FilterCollection || ( null === $ filterLocator && $ allowNull ) ) { if ( $ filterLocator instanceof FilterCollection ) { @ trigger_error ( sprintf ( ...
Sets a filter locator with a backward compatibility .
3,504
private function getFilter ( string $ filterId ) : ? FilterInterface { if ( $ this -> filterLocator instanceof ContainerInterface && $ this -> filterLocator -> has ( $ filterId ) ) { return $ this -> filterLocator -> get ( $ filterId ) ; } if ( $ this -> filterLocator instanceof FilterCollection && $ this -> filterLoca...
Gets a filter with a backward compatibility .
3,505
private function isRequiredByGroups ( ValidatorPropertyMetadataInterface $ validatorPropertyMetadata , array $ options ) : bool { foreach ( $ options [ 'validation_groups' ] as $ validationGroup ) { if ( ! \ is_string ( $ validationGroup ) ) { continue ; } foreach ( $ validatorPropertyMetadata -> findConstraints ( $ va...
Tests if the property is required because of its validation groups .
3,506
private function isRequired ( Constraint $ constraint ) : bool { foreach ( self :: REQUIRED_CONSTRAINTS as $ requiredConstraint ) { if ( $ constraint instanceof $ requiredConstraint ) { return true ; } } return false ; }
Is this constraint making the related property required?
3,507
private function getPopulatedRelations ( $ object , ? string $ format , array $ context , array $ relationships ) : array { $ data = [ ] ; if ( ! isset ( $ context [ 'resource_class' ] ) ) { return $ data ; } unset ( $ context [ 'api_included' ] ) ; foreach ( $ relationships as $ relationshipDataArray ) { $ relationshi...
Populates relationships keys .
3,508
private function getRelatedResources ( $ object , ? string $ format , array $ context , array $ relationships ) : array { if ( ! isset ( $ context [ 'api_included' ] ) ) { return [ ] ; } $ included = [ ] ; foreach ( $ relationships as $ relationshipDataArray ) { if ( ! \ in_array ( $ relationshipDataArray [ 'name' ] , ...
Populates included keys .
3,509
private function getJsonApiCacheKey ( ? string $ format , array $ context ) { try { return md5 ( $ format . serialize ( $ context ) ) ; } catch ( \ Exception $ exception ) { return false ; } }
Gets the cache key to use .
3,510
public function onKernelView ( GetResponseForControllerResultEvent $ event ) : void { $ controllerResult = $ event -> getControllerResult ( ) ; $ request = $ event -> getRequest ( ) ; $ attributes = RequestAttributesExtractor :: extractAttributes ( $ request ) ; if ( $ controllerResult instanceof Response && ( $ attrib...
Creates a Response to send to the client according to the requested format .
3,511
public function onKernelRequest ( GetResponseEvent $ event ) : void { $ request = $ event -> getRequest ( ) ; if ( 'html' !== $ request -> getRequestFormat ( '' ) || ! ( $ request -> attributes -> has ( '_api_resource_class' ) || $ request -> attributes -> getBoolean ( '_api_respond' , false ) ) ) { return ; } $ reques...
Sets SwaggerUiAction as controller if the requested format is HTML .
3,512
private function getOperation ( string $ method , string $ className ) : stdClass { foreach ( $ this -> getOperations ( $ className ) as $ operation ) { if ( $ operation -> { 'hydra:method' } === $ method ) { return $ operation ; } } throw new \ InvalidArgumentException ( sprintf ( 'Operation "%s" of class "%s" doesn\'...
Gets an operation by its method name .
3,513
private function getFilterAnnotations ( array $ miscAnnotations ) : \ Iterator { foreach ( $ miscAnnotations as $ miscAnnotation ) { if ( ApiFilter :: class === \ get_class ( $ miscAnnotation ) ) { yield $ miscAnnotation ; } } }
Filters annotations to get back only ApiFilter annotations .
3,514
private function getFilterProperties ( ApiFilter $ filterAnnotation , \ ReflectionClass $ reflectionClass , \ ReflectionProperty $ reflectionProperty = null ) : array { $ properties = [ ] ; if ( $ filterAnnotation -> properties ) { foreach ( $ filterAnnotation -> properties as $ property => $ strategy ) { if ( \ is_int...
Given a filter annotation and reflection elements find out the properties where the filter is applied .
3,515
private function readFilterAnnotations ( \ ReflectionClass $ reflectionClass , Reader $ reader ) : array { $ filters = [ ] ; foreach ( $ this -> getFilterAnnotations ( $ reader -> getClassAnnotations ( $ reflectionClass ) ) as $ filterAnnotation ) { $ filterClass = $ filterAnnotation -> filterClass ; $ id = $ this -> g...
Reads filter annotations from a ReflectionClass .
3,516
private function generateFilterId ( \ ReflectionClass $ reflectionClass , string $ filterClass , string $ filterId = null ) : string { $ suffix = null !== $ filterId ? '_' . $ filterId : $ filterId ; return 'annotated_' . Inflector :: tableize ( str_replace ( '\\' , '' , $ reflectionClass -> getName ( ) . ( new \ Refle...
Generates a unique per - class and per - filter identifier prefixed by annotated_ .
3,517
public static function getClassMetadataFromJoinAlias ( string $ alias , QueryBuilder $ queryBuilder , ManagerRegistry $ managerRegistry ) : ClassMetadata { @ trigger_error ( sprintf ( 'The use of "%s::getClassMetadataFromJoinAlias()" is deprecated since 2.4 and will be removed in 3.0. Use "%s::getEntityClassByAlias()" ...
Gets the class metadata from a given join alias .
3,518
public static function getJoinRelationship ( Join $ join ) : string { @ trigger_error ( sprintf ( 'The use of "%s::getJoinRelationship()" is deprecated since 2.3 and will be removed in 3.0. Use "%s::getJoin()" directly instead.' , __CLASS__ , Join :: class ) , E_USER_DEPRECATED ) ; return $ join -> getJoin ( ) ; }
Gets the relationship from a Join expression .
3,519
public static function getJoinAlias ( Join $ join ) : string { @ trigger_error ( sprintf ( 'The use of "%s::getJoinAlias()" is deprecated since 2.3 and will be removed in 3.0. Use "%s::getAlias()" directly instead.' , __CLASS__ , Join :: class ) , E_USER_DEPRECATED ) ; return $ join -> getAlias ( ) ; }
Gets the alias from a Join expression .
3,520
public static function getOrderByParts ( OrderBy $ orderBy ) : array { @ trigger_error ( sprintf ( 'The use of "%s::getOrderByParts()" is deprecated since 2.3 and will be removed in 3.0. Use "%s::getParts()" directly instead.' , __CLASS__ , OrderBy :: class ) , E_USER_DEPRECATED ) ; return $ orderBy -> getParts ( ) ; }
Gets the parts from an OrderBy expression .
3,521
public function onKernelResponse ( FilterResponseEvent $ event ) : void { $ apiDocUrl = $ this -> urlGenerator -> generate ( 'api_doc' , [ '_format' => 'jsonld' ] , UrlGeneratorInterface :: ABS_URL ) ; $ link = new Link ( ContextBuilder :: HYDRA_NS . 'apiDocumentation' , $ apiDocUrl ) ; $ attributes = $ event -> getReq...
Sends the Hydra header on each response .
3,522
public static function parseAndDuplicateRequest ( Request $ request ) : Request { $ query = self :: parseRequestParams ( self :: getQueryString ( $ request ) ?? '' ) ; $ body = self :: parseRequestParams ( $ request -> getContent ( ) ) ; return $ request -> duplicate ( $ query , $ body ) ; }
Gets a fixed request .
3,523
public static function parseRequestParams ( string $ source ) : array { $ source = str_replace ( '%5B' , '[' , $ source ) ; $ source = preg_replace_callback ( '/(^|(?<=&))[^=[&]+/' , function ( $ key ) { return bin2hex ( urldecode ( $ key [ 0 ] ) ) ; } , $ source ) ; parse_str ( $ source , $ params ) ; return array_com...
Parses request parameters from the specified source .
3,524
public static function generate ( string $ operationName , string $ resourceShortName , $ operationType ) : string { if ( OperationType :: SUBRESOURCE === $ operationType = OperationTypeDeprecationHelper :: getOperationType ( $ operationType ) ) { throw new InvalidArgumentException ( 'Subresource operations are not sup...
Generates a Symfony route name .
3,525
public static function inflector ( string $ name , bool $ pluralize = true ) : string { $ name = Inflector :: tableize ( $ name ) ; return $ pluralize ? Inflector :: pluralize ( $ name ) : $ name ; }
Transforms a given string to a tableized pluralized string .
3,526
protected function normalizeValues ( array $ values , string $ property ) : ? array { foreach ( $ values as $ key => $ value ) { if ( ! \ is_int ( $ key ) || ! \ is_string ( $ value ) ) { unset ( $ values [ $ key ] ) ; } } if ( empty ( $ values ) ) { $ this -> getLogger ( ) -> notice ( 'Invalid filter ignored' , [ 'exc...
Normalize the values array .
3,527
protected function hasValidValues ( array $ values , $ type = null ) : bool { foreach ( $ values as $ key => $ value ) { if ( self :: DOCTRINE_INTEGER_TYPE === $ type && null !== $ value && false === filter_var ( $ value , FILTER_VALIDATE_INT ) ) { return false ; } } return true ; }
When the field should be an integer check that the given value is a valid one .
3,528
private function shouldDoctrinePaginatorUseOutputWalkers ( QueryBuilder $ queryBuilder , string $ resourceClass = null , string $ operationName = null ) : bool { if ( null !== $ resourceClass ) { $ resourceMetadata = $ this -> resourceMetadataFactory -> create ( $ resourceClass ) ; if ( null !== $ useOutputWalkers = $ ...
Determines whether the Doctrine ORM Paginator should use output walkers .
3,529
private function addEqualityMatchStrategy ( string $ strategy , string $ field , $ value , bool $ caseSensitive , ClassMetadata $ metadata ) { $ type = $ metadata -> getTypeOfField ( $ field ) ; switch ( $ strategy ) { case MongoDbType :: STRING !== $ type : return MongoDbType :: getType ( $ type ) -> convertToDatabase...
Add equality match stage according to the strategy .
3,530
public function onKernelResponse ( FilterResponseEvent $ event ) : void { $ link = new Link ( 'mercure' , $ this -> hub ) ; $ attributes = $ event -> getRequest ( ) -> attributes ; if ( null === ( $ resourceClass = $ attributes -> get ( '_api_resource_class' ) ) || false === $ this -> resourceMetadataFactory -> create ...
Sends the Mercure header on each response .
3,531
private function generateIdentifiersUrl ( array $ identifiers , string $ resourceClass ) : array { if ( 0 === \ count ( $ identifiers ) ) { throw new InvalidArgumentException ( sprintf ( 'No identifiers defined for resource of type "%s"' , $ resourceClass ) ) ; } if ( 1 === \ count ( $ identifiers ) ) { return [ rawurl...
Generate the identifier url .
3,532
private function phpize ( array $ array , string $ key , string $ type ) { if ( ! isset ( $ array [ $ key ] ) ) { return null ; } switch ( $ type ) { case 'bool' : if ( \ is_bool ( $ array [ $ key ] ) ) { return $ array [ $ key ] ; } break ; case 'string' : if ( \ is_string ( $ array [ $ key ] ) ) { return $ array [ $ ...
Transforms a YAML attribute s value in PHP value .
3,533
protected function getProperties ( string $ resourceClass ) : \ Traversable { if ( null !== $ this -> properties ) { return yield from array_keys ( $ this -> properties ) ; } try { yield from $ this -> propertyNameCollectionFactory -> create ( $ resourceClass ) ; } catch ( ResourceClassNotFoundException $ e ) { } }
Gets all enabled properties for the given resource class .
3,534
protected function hasProperty ( string $ resourceClass , string $ property ) : bool { return \ in_array ( $ property , iterator_to_array ( $ this -> getProperties ( $ resourceClass ) ) , true ) ; }
Is the given property enabled?
3,535
protected function getMetadata ( string $ resourceClass , string $ property ) : array { $ noop = [ null , null , null , null ] ; if ( ! $ this -> hasProperty ( $ resourceClass , $ property ) ) { return $ noop ; } $ properties = explode ( '.' , $ property ) ; $ totalProperties = \ count ( $ properties ) ; $ currentResou...
Gets info about the decomposed given property for the given resource class .
3,536
public static function parseIri ( string $ iri , string $ pageParameterName ) : array { $ parts = parse_url ( $ iri ) ; if ( false === $ parts ) { throw new InvalidArgumentException ( sprintf ( 'The request URI "%s" is malformed.' , $ iri ) ) ; } $ parameters = [ ] ; if ( isset ( $ parts [ 'query' ] ) ) { $ parameters ...
Parses and standardizes the request IRI .
3,537
public static function createIri ( array $ parts , array $ parameters , string $ pageParameterName = null , float $ page = null , bool $ absoluteUrl = false ) : string { if ( null !== $ page && null !== $ pageParameterName ) { $ parameters [ $ pageParameterName ] = $ page ; } $ query = http_build_query ( $ parameters ,...
Gets a collection IRI for the given parameters .
3,538
private function getSearch ( string $ resourceClass , array $ parts , array $ filters ) : array { $ variables = [ ] ; $ mapping = [ ] ; foreach ( $ filters as $ filter ) { foreach ( $ filter -> getDescription ( $ resourceClass ) as $ variable => $ data ) { $ variables [ ] = $ variable ; $ mapping [ ] = [ '@type' => 'Ir...
Returns the content of the Hydra search property .
3,539
protected function validateType ( string $ attribute , Type $ type , $ value , string $ format = null ) { $ builtinType = $ type -> getBuiltinType ( ) ; if ( Type :: BUILTIN_TYPE_FLOAT === $ builtinType && null !== $ format && false !== strpos ( $ format , 'json' ) ) { $ isValid = \ is_float ( $ value ) || \ is_int ( $...
Validates the type of the value . Allows using integers as floats for JSON formats .
3,540
protected function denormalizeCollection ( string $ attribute , PropertyMetadata $ propertyMetadata , Type $ type , string $ className , $ value , ? string $ format , array $ context ) : array { if ( ! \ is_array ( $ value ) ) { throw new InvalidArgumentException ( sprintf ( 'The type of the "%s" attribute must be "arr...
Denormalizes a collection of objects .
3,541
protected function denormalizeRelation ( string $ attributeName , PropertyMetadata $ propertyMetadata , string $ className , $ value , ? string $ format , array $ context ) { if ( \ is_string ( $ value ) ) { try { return $ this -> iriConverter -> getItemFromIri ( $ value , $ context + [ 'fetch_data' => true ] ) ; } cat...
Denormalizes a relation .
3,542
private function setValue ( $ object , string $ attributeName , $ value ) { try { $ this -> propertyAccessor -> setValue ( $ object , $ attributeName , $ value ) ; } catch ( NoSuchPropertyException $ exception ) { } }
Sets a value of the object using the PropertyAccess component .
3,543
protected function getFactoryOptions ( array $ context ) : array { $ options = [ ] ; if ( isset ( $ context [ self :: GROUPS ] ) ) { $ options [ 'serializer_groups' ] = $ context [ self :: GROUPS ] ; } if ( isset ( $ context [ 'collection_operation_name' ] ) ) { $ options [ 'collection_operation_name' ] = $ context [ '...
Gets a valid context for property metadata factories .
3,544
protected function normalizeRelation ( PropertyMetadata $ propertyMetadata , $ relatedObject , string $ resourceClass , ? string $ format , array $ context ) { if ( null === $ relatedObject || ! empty ( $ context [ 'attributes' ] ) || $ propertyMetadata -> isReadableLink ( ) ) { if ( null === $ relatedObject ) { unset ...
Normalizes a relation as an object if is a Link or as an URI .
3,545
protected function getDataTransformer ( $ object , string $ to , array $ context = [ ] ) : ? DataTransformerInterface { foreach ( $ this -> dataTransformers as $ dataTransformer ) { if ( $ dataTransformer -> supportsTransformation ( $ object , $ to , $ context ) ) { return $ dataTransformer ; } } return null ; }
Finds the first supported data transformer if any .
3,546
protected function transformOutput ( $ object , array $ context = [ ] ) { $ outputClass = $ this -> getOutputClass ( $ this -> getObjectClass ( $ object ) , $ context ) ; if ( null !== $ outputClass && null !== $ dataTransformer = $ this -> getDataTransformer ( $ object , $ outputClass , $ context ) ) { return $ dataTr...
For a given resource it returns an output representation if any If not the resource is returned .
3,547
public static function extractAttributes ( array $ attributes ) : array { $ result = [ 'resource_class' => $ attributes [ '_api_resource_class' ] ?? null ] ; if ( $ subresourceContext = $ attributes [ '_api_subresource_context' ] ?? null ) { $ result [ 'subresource_context' ] = $ subresourceContext ; } if ( null === $ ...
Extracts resource class operation name and format request attributes . Returns an empty array if the request does not contain required attributes .
3,548
public function onKernelException ( GetResponseForExceptionEvent $ event ) : void { $ exception = $ event -> getException ( ) ; if ( ! $ exception instanceof ValidationException ) { return ; } $ format = ErrorFormatGuesser :: guessErrorFormat ( $ event -> getRequest ( ) , $ this -> errorFormats ) ; $ event -> setRespon...
Returns a list of violations normalized in the Hydra format .
3,549
protected function addJoinsForNestedProperty ( string $ property , string $ rootAlias , QueryBuilder $ queryBuilder , QueryNameGeneratorInterface $ queryNameGenerator ) : array { if ( \ func_num_args ( ) > 4 ) { $ resourceClass = func_get_arg ( 4 ) ; } else { if ( __CLASS__ !== \ get_class ( $ this ) ) { $ r = new \ Re...
Adds the necessary joins for a nested property .
3,550
private function addMatch ( Builder $ aggregationBuilder , string $ field , string $ operator , string $ value , string $ nullManagement = null ) : void { try { $ value = new \ DateTime ( $ value ) ; } catch ( \ Exception $ e ) { $ this -> logger -> notice ( 'Invalid filter ignored' , [ 'exception' => new InvalidArgume...
Adds the match stage according to the chosen null management .
3,551
protected function addWhereByStrategy ( string $ strategy , QueryBuilder $ queryBuilder , QueryNameGeneratorInterface $ queryNameGenerator , string $ alias , string $ field , $ value , bool $ caseSensitive ) { $ wrapCase = $ this -> createWrapCase ( $ caseSensitive ) ; $ valueParameter = $ queryNameGenerator -> generat...
Adds where clause according to the strategy .
3,552
protected function createWrapCase ( bool $ caseSensitive ) : \ Closure { return function ( string $ expr ) use ( $ caseSensitive ) : string { if ( $ caseSensitive ) { return $ expr ; } return sprintf ( 'LOWER(%s)' , $ expr ) ; } ; }
Creates a function that will wrap a Doctrine expression according to the specified case sensitivity .
3,553
private function createSubresourceMetadata ( $ subresource , PropertyMetadata $ propertyMetadata ) : ? SubresourceMetadata { if ( ! $ subresource ) { return null ; } $ type = $ propertyMetadata -> getType ( ) ; $ maxDepth = \ is_array ( $ subresource ) ? $ subresource [ 'maxDepth' ] ?? null : null ; if ( null !== $ typ...
Creates a SubresourceMetadata .
3,554
private function getQueryFields ( string $ resourceClass , ResourceMetadata $ resourceMetadata , string $ queryName , $ itemConfiguration , $ collectionConfiguration ) : array { $ queryFields = [ ] ; $ shortName = $ resourceMetadata -> getShortName ( ) ; $ fieldName = lcfirst ( 'query' === $ queryName ? $ shortName : $...
Gets the query fields of the schema .
3,555
private function getMutationField ( string $ resourceClass , ResourceMetadata $ resourceMetadata , string $ mutationName ) : array { $ shortName = $ resourceMetadata -> getShortName ( ) ; $ resourceType = new Type ( Type :: BUILTIN_TYPE_OBJECT , true , $ resourceClass ) ; $ deprecationReason = $ resourceMetadata -> get...
Gets the mutation field for the given operation name .
3,556
private function convertType ( Type $ type , bool $ input , ? string $ queryName , ? string $ mutationName , int $ depth = 0 ) { switch ( $ builtinType = $ type -> getBuiltinType ( ) ) { case Type :: BUILTIN_TYPE_BOOL : $ graphqlType = GraphQLType :: boolean ( ) ; break ; case Type :: BUILTIN_TYPE_INT : $ graphqlType =...
Converts a built - in type to its GraphQL equivalent .
3,557
private function getResourceObjectTypeFields ( ? string $ resourceClass , ResourceMetadata $ resourceMetadata , bool $ input , ? string $ queryName , ? string $ mutationName , int $ depth = 0 , ? array $ ioMetadata = null ) : array { $ fields = [ ] ; $ idField = [ 'type' => GraphQLType :: nonNull ( GraphQLType :: id ( ...
Gets the fields of the type of the given resource .
3,558
private function getResourcePaginatedCollectionType ( GraphQLType $ resourceType ) : GraphQLType { $ shortName = $ resourceType -> name ; if ( isset ( $ this -> graphqlTypes [ "{$shortName}Connection" ] ) ) { return $ this -> graphqlTypes [ "{$shortName}Connection" ] ; } $ edgeObjectTypeConfiguration = [ 'name' => "{$s...
Gets the type of a paginated collection of the given resource type .
3,559
private function getApiDoc ( bool $ collection , string $ resourceClass , ResourceMetadata $ resourceMetadata , string $ operationName , array $ resourceHydraDoc , array $ entrypointHydraDoc = [ ] ) : ApiDoc { if ( $ collection ) { $ method = $ this -> operationMethodResolver -> getCollectionOperationMethod ( $ resourc...
Builds ApiDoc annotation from ApiPlatform data .
3,560
private function getResourceHydraDoc ( array $ hydraApiDoc , string $ prefixedShortName ) : ? array { if ( ! isset ( $ hydraApiDoc [ 'hydra:supportedClass' ] ) || ! \ is_array ( $ hydraApiDoc [ 'hydra:supportedClass' ] ) ) { return null ; } foreach ( $ hydraApiDoc [ 'hydra:supportedClass' ] as $ supportedClass ) { if (...
Gets Hydra documentation for the given resource .
3,561
private function getOperationHydraDoc ( string $ method , array $ hydraDoc ) : array { if ( ! isset ( $ hydraDoc [ 'hydra:supportedOperation' ] ) || ! \ is_array ( $ hydraDoc [ 'hydra:supportedOperation' ] ) ) { return [ ] ; } foreach ( $ hydraDoc [ 'hydra:supportedOperation' ] as $ supportedOperation ) { if ( $ suppor...
Gets the Hydra documentation of a given operation .
3,562
private function getCollectionOperationHydraDoc ( string $ shortName , string $ method , array $ hydraEntrypointDoc ) : array { if ( ! isset ( $ hydraEntrypointDoc [ 'hydra:supportedProperty' ] ) || ! \ is_array ( $ hydraEntrypointDoc [ 'hydra:supportedProperty' ] ) ) { return [ ] ; } $ propertyName = '#Entrypoint/' . ...
Gets the Hydra documentation for the collection operation .
3,563
private function populateRelation ( array $ data , $ object , ? string $ format , array $ context , array $ components , string $ type ) : array { $ class = $ this -> getObjectClass ( $ object ) ; $ attributesMetadata = \ array_key_exists ( $ class , $ this -> attributesMetadataCache ) ? $ this -> attributesMetadataCac...
Populates _links and _embedded keys .
3,564
private function getRelationIri ( $ rel ) : string { if ( ! ( \ is_array ( $ rel ) || \ is_string ( $ rel ) ) ) { throw new UnexpectedValueException ( 'Expected relation to be an IRI or array' ) ; } return \ is_string ( $ rel ) ? $ rel : $ rel [ '_links' ] [ 'self' ] [ 'href' ] ; }
Gets the IRI of the given relation .
3,565
private function getPropertySerializerGroups ( string $ resourceClass , string $ property ) : array { $ serializerClassMetadata = $ this -> serializerClassMetadataFactory -> getMetadataFor ( $ resourceClass ) ; foreach ( $ serializerClassMetadata -> getAttributesMetadata ( ) as $ serializerAttributeMetadata ) { if ( $ ...
Gets the serializer groups defined on a property .
3,566
private function getResourceSerializerGroups ( string $ resourceClass ) : array { $ serializerClassMetadata = $ this -> serializerClassMetadataFactory -> getMetadataFor ( $ resourceClass ) ; $ groups = [ ] ; foreach ( $ serializerClassMetadata -> getAttributesMetadata ( ) as $ serializerAttributeMetadata ) { $ groups +...
Gets the serializer groups defined in a resource .
3,567
private function getManager ( string $ resourceClass , $ data ) : ? ObjectManager { $ objectManager = $ this -> managerRegistry -> getManagerForClass ( $ resourceClass ) ; if ( null === $ objectManager || ! \ is_object ( $ data ) ) { return null ; } return $ objectManager ; }
Gets the manager if applicable .
3,568
public function withType ( Type $ type ) : self { $ metadata = clone $ this ; $ metadata -> type = $ type ; return $ metadata ; }
Returns a new instance with the given type .
3,569
public function withDescription ( string $ description ) : self { $ metadata = clone $ this ; $ metadata -> description = $ description ; return $ metadata ; }
Returns a new instance with the given description .
3,570
public function withReadable ( bool $ readable ) : self { $ metadata = clone $ this ; $ metadata -> readable = $ readable ; return $ metadata ; }
Returns a new instance of Metadata with the given readable flag .
3,571
public function withWritable ( bool $ writable ) : self { $ metadata = clone $ this ; $ metadata -> writable = $ writable ; return $ metadata ; }
Returns a new instance with the given writable flag .
3,572
public function withRequired ( bool $ required ) : self { $ metadata = clone $ this ; $ metadata -> required = $ required ; return $ metadata ; }
Returns a new instance with the given required flag .
3,573
public function withWritableLink ( bool $ writableLink ) : self { $ metadata = clone $ this ; $ metadata -> writableLink = $ writableLink ; return $ metadata ; }
Returns a new instance with the given writable link flag .
3,574
public function withReadableLink ( bool $ readableLink ) : self { $ metadata = clone $ this ; $ metadata -> readableLink = $ readableLink ; return $ metadata ; }
Returns a new instance with the given readable link flag .
3,575
public function withIdentifier ( bool $ identifier ) : self { $ metadata = clone $ this ; $ metadata -> identifier = $ identifier ; return $ metadata ; }
Returns a new instance with the given identifier flag .
3,576
public function withChildInherited ( string $ childInherited ) : self { $ metadata = clone $ this ; $ metadata -> childInherited = $ childInherited ; return $ metadata ; }
Returns a new instance with the given child inherited class .
3,577
public function withSubresource ( SubresourceMetadata $ subresource = null ) : self { $ metadata = clone $ this ; $ metadata -> subresource = $ subresource ; return $ metadata ; }
Returns a new instance with the given subresource .
3,578
public function withInitializable ( bool $ initializable ) : self { $ metadata = clone $ this ; $ metadata -> initializable = $ initializable ; return $ metadata ; }
Returns a new instance with the given initializable flag .
3,579
private function addPaths ( bool $ v3 , \ ArrayObject $ paths , \ ArrayObject $ definitions , string $ resourceClass , string $ resourceShortName , ResourceMetadata $ resourceMetadata , array $ mimeTypes , string $ operationType , \ ArrayObject $ links ) { if ( null === $ operations = OperationType :: COLLECTION === $ ...
Updates the list of entries in the paths collection .
3,580
private function getPath ( string $ resourceShortName , string $ operationName , array $ operation , string $ operationType ) : string { $ path = $ this -> operationPathResolver -> resolveOperationPath ( $ resourceShortName , $ operation , $ operationType , $ operationName ) ; if ( '.{_format}' === substr ( $ path , - ...
Gets the path for an operation .
3,581
private function getPathOperation ( bool $ v3 , string $ operationName , array $ operation , string $ method , string $ operationType , string $ resourceClass , ResourceMetadata $ resourceMetadata , array $ mimeTypes , \ ArrayObject $ definitions , \ ArrayObject $ links ) : \ ArrayObject { $ pathOperation = new \ Array...
Gets a path Operation Object .
3,582
private function getDefinitionSchema ( bool $ v3 , string $ resourceClass , ResourceMetadata $ resourceMetadata , \ ArrayObject $ definitions , array $ serializerContext = null ) : \ ArrayObject { $ definitionSchema = new \ ArrayObject ( [ 'type' => 'object' ] ) ; if ( null !== $ description = $ resourceMetadata -> get...
Gets a definition Schema Object .
3,583
private function getPropertySchema ( bool $ v3 , PropertyMetadata $ propertyMetadata , \ ArrayObject $ definitions , array $ serializerContext = null ) : \ ArrayObject { $ propertySchema = new \ ArrayObject ( $ propertyMetadata -> getAttributes ( ) [ $ v3 ? 'openapi_context' : 'swagger_context' ] ?? [ ] ) ; if ( false ...
Gets a property Schema Object .
3,584
private function getType ( bool $ v3 , string $ type , bool $ isCollection , ? string $ className , ? bool $ readableLink , \ ArrayObject $ definitions , array $ serializerContext = null ) : array { if ( $ isCollection ) { return [ 'type' => 'array' , 'items' => $ this -> getType ( $ v3 , $ type , false , $ className ,...
Gets the Swagger s type corresponding to the given PHP s type .
3,585
private function getFiltersParameters ( bool $ v3 , string $ resourceClass , string $ operationName , ResourceMetadata $ resourceMetadata , \ ArrayObject $ definitions , array $ serializerContext = null ) : array { if ( null === $ this -> filterLocator ) { return [ ] ; } $ parameters = [ ] ; $ resourceFilters = $ resou...
Gets parameters corresponding to enabled filters .
3,586
private function loadExternalFiles ( RouteCollection $ routeCollection ) : void { if ( $ this -> entrypointEnabled ) { $ routeCollection -> addCollection ( $ this -> fileLoader -> load ( 'api.xml' ) ) ; } if ( $ this -> docsEnabled ) { $ routeCollection -> addCollection ( $ this -> fileLoader -> load ( 'docs.xml' ) ) ;...
Load external files .
3,587
private function addRoute ( RouteCollection $ routeCollection , string $ resourceClass , string $ operationName , array $ operation , ResourceMetadata $ resourceMetadata , string $ operationType ) : void { $ resourceShortName = $ resourceMetadata -> getShortName ( ) ; if ( isset ( $ operation [ 'route_name' ] ) ) { ret...
Creates and adds a route for the given operation to the route collection .
3,588
protected function isPropertyMapped ( string $ property , string $ resourceClass , bool $ allowAssociation = false ) : bool { if ( $ this -> isPropertyNested ( $ property , $ resourceClass ) ) { $ propertyParts = $ this -> splitPropertyParts ( $ property , $ resourceClass ) ; $ metadata = $ this -> getNestedMetadata ( ...
Determines whether the given property is mapped .
3,589
protected function isPropertyNested ( string $ property ) : bool { if ( \ func_num_args ( ) > 1 ) { $ resourceClass = ( string ) func_get_arg ( 1 ) ; } else { if ( __CLASS__ !== \ get_class ( $ this ) ) { $ r = new \ ReflectionMethod ( $ this , __FUNCTION__ ) ; if ( __CLASS__ !== $ r -> getDeclaringClass ( ) -> getName...
Determines whether the given property is nested .
3,590
protected function isPropertyEmbedded ( string $ property , string $ resourceClass ) : bool { return false !== strpos ( $ property , '.' ) && $ this -> getClassMetadata ( $ resourceClass ) -> hasField ( $ property ) ; }
Determines whether the given property is embedded .
3,591
protected function splitPropertyParts ( string $ property ) : array { $ resourceClass = null ; $ parts = explode ( '.' , $ property ) ; if ( \ func_num_args ( ) > 1 ) { $ resourceClass = func_get_arg ( 1 ) ; } elseif ( __CLASS__ !== \ get_class ( $ this ) ) { $ r = new \ ReflectionMethod ( $ this , __FUNCTION__ ) ; if ...
Splits the given property into parts .
3,592
protected function getNestedMetadata ( string $ resourceClass , array $ associations ) : ClassMetadata { $ metadata = $ this -> getClassMetadata ( $ resourceClass ) ; foreach ( $ associations as $ association ) { if ( $ metadata -> hasAssociation ( $ association ) ) { $ associationClass = $ metadata -> getAssociationTa...
Gets nested class metadata for the given resource .
3,593
private function getGroupsForItemAndCollectionOperation ( ResourceMetadata $ resourceMetadata , string $ operationName , string $ io ) : array { $ operation = $ this -> getGroupsContext ( $ resourceMetadata , $ operationName , true ) ; $ operation += $ this -> getGroupsContext ( $ resourceMetadata , $ operationName , f...
Returns groups of item & collection .
3,594
private function getPropertyMetadata ( ResourceMetadata $ resourceMetadata , string $ resourceClass , string $ io , array $ visited , array $ options ) : array { $ data = [ ] ; foreach ( $ this -> propertyNameCollectionFactory -> create ( $ resourceClass , $ options ) as $ propertyName ) { $ propertyMetadata = $ this -...
Returns a property metadata .
3,595
public function onFlush ( OnFlushEventArgs $ eventArgs ) : void { $ uow = $ eventArgs -> getEntityManager ( ) -> getUnitOfWork ( ) ; foreach ( $ uow -> getScheduledEntityInsertions ( ) as $ entity ) { $ this -> storeEntityToPublish ( $ entity , 'createdEntities' ) ; } foreach ( $ uow -> getScheduledEntityUpdates ( ) as...
Collects created updated and deleted entities .
3,596
public function postFlush ( ) : void { try { foreach ( $ this -> createdEntities as $ entity ) { $ this -> publishUpdate ( $ entity , $ this -> createdEntities [ $ entity ] ) ; } foreach ( $ this -> updatedEntities as $ entity ) { $ this -> publishUpdate ( $ entity , $ this -> updatedEntities [ $ entity ] ) ; } foreach...
Publishes updates for changes collected on flush and resets the store .
3,597
protected function getFilterDescription ( string $ fieldName , string $ operator ) : array { return [ sprintf ( '%s[%s]' , $ fieldName , $ operator ) => [ 'property' => $ fieldName , 'type' => 'string' , 'required' => false , ] , ] ; }
Gets filter description .
3,598
private function normalizeBetweenValues ( array $ values ) : ? array { if ( 2 !== \ count ( $ values ) ) { $ this -> getLogger ( ) -> notice ( 'Invalid filter ignored' , [ 'exception' => new InvalidArgumentException ( sprintf ( 'Invalid format for "[%s]", expected "<min>..<max>"' , self :: PARAMETER_BETWEEN ) ) , ] ) ;...
Normalize the values array for between operator .
3,599
private function normalizeValue ( string $ value , string $ operator ) { if ( ! is_numeric ( $ value ) ) { $ this -> getLogger ( ) -> notice ( 'Invalid filter ignored' , [ 'exception' => new InvalidArgumentException ( sprintf ( 'Invalid value for "[%s]", expected number' , $ operator ) ) , ] ) ; return null ; } return ...
Normalize the value .