\Pho\Framework\HandlersSet

Setter Handler

A setter may have two forms;

  • setSomething() which would be used for Fields, where Something is a Field.
  • something() which would be used for outgoing edges.

In this class we don't modify $name arguments (unlike what we do in Form, Get and Has classes) because we expect the method to be called in the proper format, and:

  • for Fields, they are already stored in the particle in upper-camelized format.
  • for outgoing edges, they are already stored in the particle in camlized format.

Summary

Methods
Properties
Constants
handle()
No public properties found
No constants found
field()
saveField()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

handle()

handle(\Pho\Framework\ParticleInterface  $particle, array  $pack, \Pho\Framework\Handlers\string  $name, array  $args) : mixed

Catch-all handler

Parameters

\Pho\Framework\ParticleInterface $particle

The particle that this handler is working on.

array $pack

Holds cargo variables extracted by loaders.

\Pho\Framework\Handlers\string $name

Catch-all method name

array $args

Catch-all method arguments

Throws

\InvalidArgumentException

thrown when there argument does not meet the constraints.

Returns

mixed —

"Has"=>bool. Get=>array. Set/Form=>\Pho\Lib\Graph\EdgeInterface by default, but in order to provide flexibility for higher-level components to return node (in need) the official return value is \Pho\Lib\Graph\EntityInterface which is the parent of both NodeInterface and EdgeInterface.

field()

field(\Pho\Framework\ParticleInterface  $particle, \Pho\Framework\Cargo\FieldsCargo  $cargo, string  $name, array  $value) : void

Sets the field value

Parameters

\Pho\Framework\ParticleInterface $particle
\Pho\Framework\Cargo\FieldsCargo $cargo
string $name

Field name

array $value

Throws

\InvalidArgumentException

thrown when there argument does not meet the constraints.

saveField()

saveField(\Pho\Framework\ParticleInterface  $particle, string  $field_name, mixed  $field_value, boolean  $defer_persist, \Pho\Framework\FieldHelper  $helper) : void

Helper method to save the field

This method exists to help extending the "field" method without overriding it.

Parameters

\Pho\Framework\ParticleInterface $particle
string $field_name

Field name

mixed $field_value

Field value

boolean $defer_persist

Whether to defer persistence

\Pho\Framework\FieldHelper $helper

an object full of information re: this field.

Throws

\InvalidArgumentException

thrown when there argument does not meet the constraints.