Phalcon annotations
NOTE
All classes are prefixed with Phalcon
Annotations\AdapterFactory¶
Class Source on GitHub
Factory to create Annotations adapters
@property SerializerFactory $serializerFactory
Phalcon\Annotations\AdapterFactory
Uses Exception · Phalcon\Annotations\Adapter\AdapterInterface · Phalcon\Annotations\Adapter\Apcu · Phalcon\Annotations\Adapter\Libmemcached · Phalcon\Annotations\Adapter\Memory · Phalcon\Annotations\Adapter\Redis · Phalcon\Annotations\Adapter\Stream · Phalcon\Annotations\Adapter\Weak · Phalcon\Annotations\Parser\Exception · Phalcon\Storage\SerializerFactory · Phalcon\Traits\Factory\FactoryTrait
Method Summary¶
public
__construct(SerializerFactory $factory,array $services = [])
AdapterFactory constructor.
public
AdapterInterface
newInstance(string $name,array $options = [])
Create a new instance of the adapter
protected
string
getExceptionClass()
protected
array
getServices()
Returns the available adapters
Methods¶
__construct()¶
AdapterFactory constructor.
newInstance()¶
Create a new instance of the adapter
getExceptionClass()¶
getServices()¶
Returns the available adapters
Annotations\Adapter\AdapterInterface¶
Interface Source on GitHub
This interface must be implemented by adapters in Phalcon\Components\Attributes
Phalcon\Storage\Adapter\AdapterInterfacePhalcon\Annotations\Adapter\AdapterInterface
Uses Phalcon\Storage\Adapter\AdapterInterface
Annotations\Adapter\Apcu¶
Class Source on GitHub
Stores the parsed annotations in apcu.
Phalcon\Storage\Adapter\AbstractAdapterPhalcon\Storage\Adapter\ApcuPhalcon\Annotations\Adapter\Apcu- implementsPhalcon\Annotations\Adapter\AdapterInterface
Uses Phalcon\Annotations\Parser\Reflection · Phalcon\Storage\Adapter\Apcu
Method Summary¶
Methods¶
get()¶
Annotations\Adapter\Libmemcached¶
Class Source on GitHub
Stores the parsed annotations in memory. This adapter is the suitable development/testing
Phalcon\Storage\Adapter\AbstractAdapterPhalcon\Storage\Adapter\LibmemcachedPhalcon\Annotations\Adapter\Libmemcached- implementsPhalcon\Annotations\Adapter\AdapterInterface
Uses Phalcon\Annotations\Parser\Reflection · Phalcon\Storage\Adapter\Libmemcached
Method Summary¶
Methods¶
get()¶
Annotations\Adapter\Memory¶
Class Source on GitHub
Stores the parsed annotations in memory. This adapter is the suitable development/testing
Phalcon\Storage\Adapter\AbstractAdapterPhalcon\Storage\Adapter\MemoryPhalcon\Annotations\Adapter\Memory- implementsPhalcon\Annotations\Adapter\AdapterInterface
Uses Phalcon\Annotations\Parser\Reflection · Phalcon\Storage\Adapter\Memory
Method Summary¶
Methods¶
get()¶
Annotations\Adapter\Redis¶
Class Source on GitHub
Stores the parsed annotations in redis.
Phalcon\Storage\Adapter\AbstractAdapterPhalcon\Storage\Adapter\RedisPhalcon\Annotations\Adapter\Redis- implementsPhalcon\Annotations\Adapter\AdapterInterface
Uses Phalcon\Annotations\Parser\Reflection · Phalcon\Storage\Adapter\Redis
Method Summary¶
Methods¶
get()¶
Annotations\Adapter\Stream¶
Class Source on GitHub
Stores the parsed annotations in memory. This adapter is the suitable development/testing
Phalcon\Storage\Adapter\AbstractAdapterPhalcon\Storage\Adapter\StreamPhalcon\Annotations\Adapter\Stream- implementsPhalcon\Annotations\Adapter\AdapterInterface
Uses Phalcon\Annotations\Parser\Reflection · Phalcon\Storage\Adapter\Stream
Method Summary¶
Methods¶
get()¶
Annotations\Adapter\Weak¶
Class Source on GitHub
Stores the parsed annotations in memory. This adapter is the suitable development/testing
Phalcon\Storage\Adapter\AbstractAdapterPhalcon\Storage\Adapter\WeakPhalcon\Annotations\Adapter\Weak- implementsPhalcon\Annotations\Adapter\AdapterInterface
Uses Phalcon\Annotations\Parser\Reflection · Phalcon\Storage\Adapter\Weak
Method Summary¶
Methods¶
get()¶
Annotations\Annotations¶
Class Source on GitHub
Phalcon\Annotations\Annotations
Uses Phalcon\Annotations\Parser\Collection · Phalcon\Annotations\Parser\Reader · Phalcon\Annotations\Parser\ReaderInterface · Phalcon\Annotations\Parser\Reflection · Phalcon\Storage\Adapter\AdapterInterface
Method Summary¶
public
__construct( AdapterInterface $adapter )
public
Reflection
get( mixed $className )
Parses or retrieves all the attributes found in a class
public
Collection
getConstant(string $className,string $constantName)
Returns the attributes found in a specific constant
public
array
getConstants( string $className )
Returns the attributes found in all the class' constants
public
Collection
getMethod(string $className,string $methodName)
Returns the attributes found in a specific method
public
array
getMethods( string $className )
Returns the attributes found in all the class' methods
public
array
getProperties( string $className )
Returns the attributes found in all the class' properties
public
Collection
getProperty(string $className,string $propertyName)
Returns the attributes found in a specific property
public
ReaderInterface
getReader()
Returns the annotation reader
public
bool|Reflection
read( string $key )
Reads parsed annotations from memory
public
void
setReader( ReaderInterface $reader )
Sets the attributes parser
public
bool
write(string $key,Reflection $data)
Writes parsed annotations to memory
Constants¶
string
CACHE_PREFIX = "_PHATN"
Properties¶
protected
AdapterInterface
$adapter
protected
array
$attributes = []
protected
Reader|null
$reader = null
Methods¶
__construct()¶
get()¶
Parses or retrieves all the attributes found in a class
getConstant()¶
Returns the attributes found in a specific constant
getConstants()¶
Returns the attributes found in all the class' constants
getMethod()¶
Returns the attributes found in a specific method
getMethods()¶
Returns the attributes found in all the class' methods
getProperties()¶
Returns the attributes found in all the class' properties
getProperty()¶
Returns the attributes found in a specific property
getReader()¶
Returns the annotation reader
read()¶
Reads parsed annotations from memory
setReader()¶
Sets the attributes parser
write()¶
Writes parsed annotations to memory
Annotations\Models\MetaData\Column¶
Class Source on GitHub
Phalcon\Annotations\Models\MetaData\Column
Uses Attribute
Method Summary¶
Properties¶
public
bool
$allowEmptyString = false
public
string|null
$column = null
public
mixed
$default = null
public
int|null
$length = null
public
bool
$nullable = false
public
bool
$skipOnInsert = false
public
bool
$skipOnUpdate = false
public
string
$type = "string"
Methods¶
__construct()¶
public function __construct(
string|null $column = null,
string $type = "string",
int|null $length = null,
bool $nullable = false,
bool $skipOnInsert = false,
bool $skipOnUpdate = false,
bool $allowEmptyString = false,
mixed $default = null
);
Annotations\Models\MetaData\Identity¶
Class Source on GitHub
Phalcon\Annotations\Models\MetaData\Identity
Uses Attribute
Annotations\Models\MetaData\Primary¶
Class Source on GitHub
Phalcon\Annotations\Models\MetaData\Primary
Uses Attribute
Annotations\Models\MetaData\Source¶
Class Source on GitHub
Phalcon\Annotations\Models\MetaData\Source
Uses Attribute
Method Summary¶
Properties¶
public
string
$table
Methods¶
__construct()¶
Annotations\Parser\Annotation¶
Class Source on GitHub
Represents a single attribute in an attributes collection
Phalcon\Annotations\Parser\Annotation
Uses ReflectionAttribute
Method Summary¶
public
__construct( ReflectionAttribute $reflectionData )
Constructor
public
mixed
getArgument( int|string $position )
Returns an argument in a specific position
public
array
getArguments()
Returns the expression arguments
public
string
getCleanName()
Returns the attribute's base name
public
string
getName()
Returns the attribute's name
public
mixed
getNamedArgument( string $name )
Returns a named argument
public
mixed
getNamedParameter( string $name )
Returns a named parameter
public
bool
hasArgument( int|string $position )
Returns an argument in a specific position
public
int
numberArguments()
Returns the number of arguments that the attribute has
Properties¶
protected
array
$arguments = []
Attribute Arguments
protected
string
$name
Attribute Name
Methods¶
__construct()¶
Constructor
getArgument()¶
Returns an argument in a specific position
getArguments()¶
Returns the expression arguments
getCleanName()¶
Returns the attribute's base name
getName()¶
Returns the attribute's name
getNamedArgument()¶
Returns a named argument
getNamedParameter()¶
Returns a named parameter
hasArgument()¶
Returns an argument in a specific position
numberArguments()¶
Returns the number of arguments that the attribute has
Annotations\Parser\Collection¶
Class Source on GitHub
Represents a collection of annotations. This class allows to traverse a group of annotations easily
// Traverse annotations
foreach ($classAnnotations as $annotation) {
echo "Name=", $annotation->getName(), PHP_EOL;
}
// Check if the annotations has a specific
var_dump($classAnnotations->has("Cacheable"));
// Get an specific annotation in the collection
$annotation = $classAnnotations->get("Cacheable");
@template TKey of int
@template TValue of Annotation
Phalcon\Annotations\Parser\Collection- implements\IteratorAggregate
Uses ArrayIterator · IteratorAggregate · Traversable
Method Summary¶
public
__construct( array $reflectionData = [] )
Constructor
public
Annotation
get( string $name )
Returns the first annotation that match a name
public
array
getAll( string $name )
Returns all the annotations that match a name
public
Traversable
getAnnotations()
public
Traversable
getIterator()
public
bool
has( string $name )
Check if an annotation exists in a collection
Properties¶
protected
array
$annotations
protected
int
$position = 0
Methods¶
__construct()¶
Constructor
get()¶
Returns the first annotation that match a name
getAll()¶
Returns all the annotations that match a name
getAnnotations()¶
getIterator()¶
has()¶
Check if an annotation exists in a collection
Annotations\Parser\Exception¶
Class Source on GitHub
Class for exceptions thrown by Phalcon\Annotations
\ExceptionPhalcon\Annotations\Parser\Exception
Annotations\Parser\Reader¶
Class Source on GitHub
Parses classes returning an array with the found annotations
Phalcon\Annotations\Parser\Reader- implementsPhalcon\Annotations\Parser\ReaderInterface
Uses ReflectionClass · ReflectionException
Method Summary¶
Methods¶
parse()¶
Reads annotations from the class, its methods and/or properties
Annotations\Parser\ReaderInterface¶
Interface Source on GitHub
Parses attributes returning an array with the found attributes
Phalcon\Annotations\Parser\ReaderInterface
Method Summary¶
Methods¶
parse()¶
Reads attributes from the class, properties and methods
Annotations\Parser\Reflection¶
Class Source on GitHub
Allows to manipulate the annotations reflection in an OO manner
use Phalcon\Components\Annotations\Reader;
use Phalcon\Components\Annotations\Reflection;
// Parse the annotations in a class
$reader = new Reader();
$parsing = $reader->parse("MyComponent");
// Create the reflection
$reflection = new Reflection($parsing);
// Get the annotations from the class
$classAnnotations = $reflection->getClassAnnotations();
Phalcon\Annotations\Parser\Reflection
Method Summary¶
public
__construct( array $reflectionData = [] )
Constructor
public
Collection|null
getClassAnnotations()
Returns the annotations found in the class docblock
public
array
getConstantsAnnotations()
Returns the annotations found as constants
public
array
getMethodsAnnotations()
Returns the annotations found at methods
public
array
getPropertiesAnnotations()
Returns the annotations found at properties
public
array
getReflectionData()
Returns the raw parsing intermediate definitions used to construct the
Properties¶
protected
Collection|null
$classAnnotations = null
protected
array
$constantAnnotations = []
protected
array
$methodAnnotations = []
protected
array
$propertyAnnotations = []
protected
array
$reflectionData = []
Methods¶
__construct()¶
Constructor
getClassAnnotations()¶
Returns the annotations found in the class docblock
getConstantsAnnotations()¶
Returns the annotations found as constants
getMethodsAnnotations()¶
Returns the annotations found at methods
getPropertiesAnnotations()¶
Returns the annotations found at properties
getReflectionData()¶
Returns the raw parsing intermediate definitions used to construct the reflection
Annotations\Router\Connect¶
Class Source on GitHub
Phalcon\Annotations\Router\RoutePhalcon\Annotations\Router\Connect
Uses Attribute · Phalcon\Http\Message\Interfaces\RequestMethodInterface
Method Summary¶
Methods¶
__construct()¶
Annotations\Router\Delete¶
Class Source on GitHub
Phalcon\Annotations\Router\RoutePhalcon\Annotations\Router\Delete
Uses Attribute · Phalcon\Http\Message\Interfaces\RequestMethodInterface
Method Summary¶
Methods¶
__construct()¶
Annotations\Router\Get¶
Class Source on GitHub
Phalcon\Annotations\Router\RoutePhalcon\Annotations\Router\Get
Uses Attribute · Phalcon\Http\Message\Interfaces\RequestMethodInterface
Method Summary¶
Methods¶
__construct()¶
Annotations\Router\Head¶
Class Source on GitHub
Phalcon\Annotations\Router\RoutePhalcon\Annotations\Router\Head
Uses Attribute · Phalcon\Http\Message\Interfaces\RequestMethodInterface
Method Summary¶
Methods¶
__construct()¶
Annotations\Router\Options¶
Class Source on GitHub
Phalcon\Annotations\Router\RoutePhalcon\Annotations\Router\Options
Uses Attribute · Phalcon\Http\Message\Interfaces\RequestMethodInterface
Method Summary¶
Methods¶
__construct()¶
Annotations\Router\Patch¶
Class Source on GitHub
Phalcon\Annotations\Router\RoutePhalcon\Annotations\Router\Patch
Uses Attribute · Phalcon\Http\Message\Interfaces\RequestMethodInterface
Method Summary¶
Methods¶
__construct()¶
Annotations\Router\Post¶
Class Source on GitHub
Phalcon\Annotations\Router\RoutePhalcon\Annotations\Router\Post
Uses Attribute · Phalcon\Http\Message\Interfaces\RequestMethodInterface
Method Summary¶
Methods¶
__construct()¶
Annotations\Router\Purge¶
Class Source on GitHub
Phalcon\Annotations\Router\RoutePhalcon\Annotations\Router\Purge
Uses Attribute · Phalcon\Http\Message\Interfaces\RequestMethodInterface
Method Summary¶
Methods¶
__construct()¶
Annotations\Router\Put¶
Class Source on GitHub
Phalcon\Annotations\Router\RoutePhalcon\Annotations\Router\Put
Uses Attribute · Phalcon\Http\Message\Interfaces\RequestMethodInterface
Method Summary¶
Methods¶
__construct()¶
Annotations\Router\Route¶
Class Source on GitHub
Phalcon\Annotations\Router\RoutePhalcon\Annotations\Router\ConnectPhalcon\Annotations\Router\DeletePhalcon\Annotations\Router\GetPhalcon\Annotations\Router\HeadPhalcon\Annotations\Router\OptionsPhalcon\Annotations\Router\PatchPhalcon\Annotations\Router\PostPhalcon\Annotations\Router\PurgePhalcon\Annotations\Router\PutPhalcon\Annotations\Router\Trace
Uses Attribute · Phalcon\Http\Message\Interfaces\RequestMethodInterface
Method Summary¶
Properties¶
public
array|string|null
$beforeMatch = null
public
array
$converters = []
public
array|string
$methods = [...]
public
string|null
$name = null
public
array
$paths = []
public
string
$route
Methods¶
__construct()¶
public function __construct(
string $route,
array|string $methods = [...],
string|null $name = null,
array $paths = [],
array $converters = [],
array|string|null $beforeMatch = null
);
Annotations\Router\RoutePrefix¶
Class Source on GitHub
Phalcon\Annotations\Router\RoutePrefix
Uses Attribute
Method Summary¶
Properties¶
public
string
$prefix
Methods¶
__construct()¶
Annotations\Router\Trace¶
Class Source on GitHub
Phalcon\Annotations\Router\RoutePhalcon\Annotations\Router\Trace
Uses Attribute · Phalcon\Http\Message\Interfaces\RequestMethodInterface