PHP Class Node

S -> P P -> T R I I -> P I -> e R -> '[]' N O R -> N O O -> '{' P '}' O -> e N -> 'token=name' T -> 'token=type'
Mostrar archivo Open project: croogo/croogo Class Usage Examples

Public Properties

Property Type Description
$actsAs array Behaviors used by the Model
$belongsTo array Model associations: belongsTo
$filterArgs array Filter search fields
$findMethods
$guid string Guid
$name string Model name
$type string If the Model is associated to Node model, this variable holds the Node type value
$validate array Validation

Public Methods

Method Description
beforeFind ( $queryData ) : array beforeFind callback
beforeSave ( $options = [] ) : boolean beforeSave callback
filterNodes ( $data = [] ) : array Return filter condition for Nodes
filterPublishedNodes ( $data = [] ) : array Return filter condition for Nodes
formatData ( array $data, string $typeAlias = self::DEFAULT_TYPE ) : array Format data for saving
isUniquePerType ( array $fields, boolean $or = true ) : boolean Returns false if any fields passed match any (by default, all if $or = false) of their matching values.
saveNode ( $data, $typeAlias = self::DEFAULT_TYPE ) : mixed Create/update a Node record
updateAllNodesPaths ( ) : boolean | array Update values for all nodes 'path' field

Protected Methods

Method Description
_findPromoted ( $state, $query, $results = [] ) Find promoted nodes
_findPublished ( $state, $query, $results = [] ) Search published nodes
_findViewById ( $state, $query, $results = [] ) Find a single node by id
_findViewBySlug ( $state, $query, $results = [] ) Find a single node by slug
_getNodeRelativePath ( array $node ) : string getNodeRelativePath
_getType ( array $data ) : string _getType
_mergeQueryFilters ( &$query, $key, $values ) : void mergeQueryFilters

Method Details

_findPromoted() protected method

Find promoted nodes
See also: Model::find()
See also: Model::_findAll()
protected _findPromoted ( $state, $query, $results = [] )

_findPublished() protected method

$query options: - q: term to search - roleId: Role Id - typeAlias: Type alias
protected _findPublished ( $state, $query, $results = [] )

_findViewById() protected method

Find a single node by id
protected _findViewById ( $state, $query, $results = [] )

_findViewBySlug() protected method

Find a single node by slug
protected _findViewBySlug ( $state, $query, $results = [] )

_getNodeRelativePath() protected method

getNodeRelativePath
protected _getNodeRelativePath ( array $node ) : string
$node array Node array
return string relative node path

_getType() protected method

_getType
protected _getType ( array $data ) : string
$data array Node data
return string type

_mergeQueryFilters() protected method

mergeQueryFilters
See also: Node::_findPromoted()
protected _mergeQueryFilters ( &$query, $key, $values ) : void
return void

beforeFind() public method

beforeFind callback
public beforeFind ( $queryData ) : array
return array

beforeSave() public method

beforeSave callback
public beforeSave ( $options = [] ) : boolean
return boolean

filterNodes() public method

Return filter condition for Nodes
public filterNodes ( $data = [] ) : array
return array Array of conditions

filterPublishedNodes() public method

Return filter condition for Nodes
public filterPublishedNodes ( $data = [] ) : array
return array Array of conditions

formatData() public method

Format data for saving
public formatData ( array $data, string $typeAlias = self::DEFAULT_TYPE ) : array
$data array Node and related data, eg Taxonomy and Role
$typeAlias string string Node type alias
return array formatted data

isUniquePerType() public method

Returns false if any fields passed match any (by default, all if $or = false) of their matching values.
public isUniquePerType ( array $fields, boolean $or = true ) : boolean
$fields array Field/value pairs to search (if no values specified, they are pulled from $this->data)
$or boolean If false, all fields specified must match in order for a false return value
return boolean False if any records matching any fields are found

saveNode() public method

Create/update a Node record
public saveNode ( $data, $typeAlias = self::DEFAULT_TYPE ) : mixed
$data array Node data
$typeAlias string Node type alias
return mixed see Model::saveAll()

updateAllNodesPaths() public method

Update values for all nodes 'path' field
See also: Model::saveMany()
public updateAllNodesPaths ( ) : boolean | array
return boolean | array Depending on atomicity

Property Details

$actsAs public_oe property

Behaviors used by the Model
public array $actsAs
return array

$belongsTo public_oe property

Model associations: belongsTo
public array $belongsTo
return array

$filterArgs public_oe property

Filter search fields
public array $filterArgs
return array

$findMethods public_oe property

public $findMethods

$guid public_oe property

Guid
public string $guid
return string

$name public_oe property

Model name
public string $name
return string

$type public_oe property

If the Model is associated to Node model, this variable holds the Node type value
public string $type
return string

$validate public_oe property

Validation
public array $validate
return array