PHP 클래스 Drest\Query\ExposeFields

상속: implements Iterator
파일 보기 프로젝트 열기: leedavis81/drest 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$registered_expose_classes array Temporary used during processExposeDepth to prevent you traversing up and down bi-directional relations
$route Drest\Mapping\RouteMetaData The matched route
$route_expose array The route expose array - If explicitly set it overrides any default config settings

공개 메소드들

메소드 설명
configureExposeDepth ( Drest\EntityManagerRegistry $emr, integer $exposureDepth, integer $exposureRelationsFetchType = null ) : ExposeFields Set the default exposure fields using the configured exposure depth
configurePullRequest ( array $requestOptions, DrestCommon\Request\Request $request ) : ExposeFields Configure the expose object to filter out fields that have been explicitly requested by the client.
configurePushRequest ( array $pushed ) : DrestCommon\ResultSet Configure the expose object to filter out fields that are not allowed to be use by the client.
create ( RouteMetaData $route ) : ExposeFields Create an instance of ExposeFields
current ( )
key ( )
next ( )
rewind ( )
toArray ( ) : array Get the expose fields
valid ( )

보호된 메소드들

메소드 설명
filterPushExpose ( array $requested, array $actual ) : array Filter out requested expose fields against what's allowed
filterRequestedExpose ( array &$requested, array &$actual ) Filter out requested expose fields against what's allowed
parseExposeString ( string $string ) : array An awesome solution was posted on (link below) to parse these using a regex http://stackoverflow.com/questions/16415558/regex-top-level-contents-from-a-string
processExposeDepth ( array &$fields, string $class, Drest\EntityManagerRegistry $emr, integer $depth, integer $fetchType = null ) Recursive function to generate default expose columns
recurseExposeString ( string $string, array &$results ) Recursively process the passed expose string

비공개 메소드들

메소드 설명
__construct ( RouteMetaData $route ) Create an instance of ExposeFields - use create() method
parseStringParts ( string $string ) : stdClass Get information on parsed (top-level) brackets

메소드 상세

configureExposeDepth() 공개 메소드

Set the default exposure fields using the configured exposure depth
public configureExposeDepth ( Drest\EntityManagerRegistry $emr, integer $exposureDepth, integer $exposureRelationsFetchType = null ) : ExposeFields
$emr Drest\EntityManagerRegistry
$exposureDepth integer
$exposureRelationsFetchType integer
리턴 ExposeFields $this object instance

configurePullRequest() 공개 메소드

This is only applicable for a HTTP pull (GET) call. For configuring
public configurePullRequest ( array $requestOptions, DrestCommon\Request\Request $request ) : ExposeFields
$requestOptions array
$request DrestCommon\Request\Request
리턴 ExposeFields $this object instance

configurePushRequest() 공개 메소드

Unlike the configuring of the Pull request, this function will return the formatted array in a ResultSet object This is only applicable for a HTTP push (POST/PUT/PATCH) call
public configurePushRequest ( array $pushed ) : DrestCommon\ResultSet
$pushed array - the data push on the request
리턴 DrestCommon\ResultSet

create() 공개 정적인 메소드

Create an instance of ExposeFields
public static create ( RouteMetaData $route ) : ExposeFields
$route Drest\Mapping\RouteMetaData - requires a matched route
리턴 ExposeFields

current() 공개 메소드

public current ( )

filterPushExpose() 보호된 메소드

Filter out requested expose fields against what's allowed
protected filterPushExpose ( array $requested, array $actual ) : array
$requested array - The requested expose definition
$actual array - current allowed expose definition
리턴 array $request - The requested expose data with non-allowed data stripped off

filterRequestedExpose() 보호된 메소드

Filter out requested expose fields against what's allowed
protected filterRequestedExpose ( array &$requested, array &$actual )
$requested array - The requested expose definition - invalid / not allowed data is stripped off
$actual array - current allowed expose definition

key() 공개 메소드

public key ( )

next() 공개 메소드

public next ( )

parseExposeString() 보호된 메소드

preg_match_all( '/(?<=\[) # Assert that the previous characters is a [ (?: # Match either... [^[\]]* # any number of characters except brackets | # or \[ # an opening bracket (?R) # containing a match of this very regex \] # followed by a closing bracket )* # Repeat as needed (?=\]) # Assert the next character is a ]/x', $string, $result, PREG_PATTERN_ORDER);
protected parseExposeString ( string $string ) : array
$string string
리턴 array $result

processExposeDepth() 보호된 메소드

Recursive function to generate default expose columns
protected processExposeDepth ( array &$fields, string $class, Drest\EntityManagerRegistry $emr, integer $depth, integer $fetchType = null )
$fields array - array to be populated recursively (referenced)
$class string - name of the class to process
$emr Drest\EntityManagerRegistry - entity manager registry used to fetch class information
$depth integer - maximum depth you want to travel through the relations
$fetchType integer - The fetch type to be used

recurseExposeString() 보호된 메소드

Recursively process the passed expose string
protected recurseExposeString ( string $string, array &$results )
$string string - the string to be processed
$results array - passed by reference

rewind() 공개 메소드

public rewind ( )

toArray() 공개 메소드

Get the expose fields
public toArray ( ) : array
리턴 array $fields

valid() 공개 메소드

public valid ( )

프로퍼티 상세

$registered_expose_classes 보호되어 있는 프로퍼티

Temporary used during processExposeDepth to prevent you traversing up and down bi-directional relations
protected array $registered_expose_classes
리턴 array

$route 보호되어 있는 프로퍼티

The matched route
protected RouteMetaData,Drest\Mapping $route
리턴 Drest\Mapping\RouteMetaData

$route_expose 보호되어 있는 프로퍼티

The route expose array - If explicitly set it overrides any default config settings
protected array $route_expose
리턴 array