Phalcon contracts
NOTE
All classes are prefixed with Phalcon
Contracts\Assets\Asset¶
Interface Source on GitHub
Canonical contract for Phalcon\Assets\Asset.
Covers collection membership: an asset's key, type, HTML attributes, and filter flag. The file-output pipeline (Phalcon\Assets\Manager::output()) requires the concrete Phalcon\Assets\Asset class.
Phalcon\Contracts\Assets\Asset
Method Summary¶
public string getAssetKey() Gets the asset's key. public array|null getAttributes() Gets extra HTML attributes. public bool getFilter() Gets if the asset must be filtered or not. public string getType() Gets the asset's type. public Asset setAttributes( array $attributes ) Sets extra HTML attributes. public Asset setFilter( bool $filter ) Sets if the asset must be filtered or not. public Asset setType( string $type ) Sets the asset's type. Methods¶
getAssetKey()¶
Gets the asset's key.
getAttributes()¶
Gets extra HTML attributes.
getFilter()¶
Gets if the asset must be filtered or not.
getType()¶
Gets the asset's type.
setAttributes()¶
Sets extra HTML attributes.
setFilter()¶
Sets if the asset must be filtered or not.
setType()¶
Sets the asset's type.
Contracts\Assets\Filter¶
Interface Source on GitHub
Canonical contract for Phalcon\Assets filters (Cssmin, Jsmin, None, and custom user filters).
Phalcon\Contracts\Assets\Filter
Method Summary¶
Methods¶
filter()¶
Filters the content returning a string with the filtered content
Contracts\Auth\Access\Access¶
Interface Source on GitHub
Access gates are Specifications: policies that decide whether the current identity may run the given action. The enforcement point passes the identity (the guard) and the request context on every call; gates hold no reference to the auth manager.
Phalcon\Contracts\Auth\Access\Access
Uses Phalcon\Contracts\Auth\Guard\Guard
Method Summary¶
public array getExceptActions() public array getOnlyActions() public bool isAllowed(Guard $guard,string $actionName,array $context = []) Whether the identity behind the guard may run the action. public array|null redirectTo() public void setExceptActions( array $exceptActions = [] ) Exempts the listed action names from the gate; every other action is public void setOnlyActions( array $onlyActions = [] ) Restricts the gate to the listed action names. Methods¶
getExceptActions()¶
getOnlyActions()¶
isAllowed()¶
Whether the identity behind the guard may run the action.
redirectTo()¶
setExceptActions()¶
Exempts the listed action names from the gate; every other action is checked. See setOnlyActions() for the gate-family divergence note.
setOnlyActions()¶
Restricts the gate to the listed action names.
Authoritative semantics: the gate applies only to the listed actions; an action that is not listed passes without a check (and except() is the inverse - the gate applies to every action except those listed).
NOTE: the implementations currently diverge. The Acl gate follows the authoritative semantics above, while the binary gates (Auth, Guest) treat only as a whitelist - an unlisted action is denied even when the base condition holds. The two gate families will be aligned in the next major version; until then, choose the gate family deliberately, because for an unlisted action they return opposite answers to the same call.
Contracts\Auth\Adapter\Adapter¶
Interface Source on GitHub
Authentication adapter contract.
Adapters look users up by credentials or by identifier and verify the password against the stored hash. The credential payload is intentionally unsealed: any user-row field may be used as the lookup key, plus an optional password entry that is ignored during the row match and consumed only by validateCredentials().
Phalcon\Contracts\Auth\Adapter\Adapter
Uses Phalcon\Contracts\Auth\AuthUser · Phalcon\Contracts\Encryption\Security\Security
Method Summary¶
public static fromOptions(Security $hasher,array $options) Build an adapter from a flat options map. Used by ManagerFactory to public AuthUser|null retrieveByCredentials( array $credentials ) Find a user matching the given credentials (e.g. ['email' => 'a@b']). public AuthUser|null retrieveById( mixed $id ) Find a user by their unique identifier. public bool validateCredentials(AuthUser $user,array $credentials) Validate the provided credentials against the given user. Methods¶
fromOptions()¶
Build an adapter from a flat options map. Used by ManagerFactory to wire adapters from the application config; each implementation is free to interpret the option keys it cares about.
retrieveByCredentials()¶
Find a user matching the given credentials (e.g. ['email' => 'a@b']). The 'password' key, if present, is ignored during the lookup. Returns null if no user matches.
retrieveById()¶
Find a user by their unique identifier.
validateCredentials()¶
Validate the provided credentials against the given user. Implementations typically verify the password hash held under the 'password' key.
Contracts\Auth\Adapter\AdapterConfig¶
Interface Source on GitHub
Authentication adapter configuration contract.
Per-adapter config shape is intentionally adapter-specific (e.g. Stream exposes getFile(), Memory exposes getUsers()); the only field shared across all adapters is the optional model class used during user hydration.
Phalcon\Contracts\Auth\Adapter\AdapterConfig
Method Summary¶
Methods¶
getModel()¶
Returns the user-model class name to hydrate, if configured.
Contracts\Auth\Adapter\RememberAdapter¶
Interface Source on GitHub
Capability extension implemented by adapters that support remember-me.
Phalcon\Contracts\Auth\Adapter\AdapterPhalcon\Contracts\Auth\Adapter\RememberAdapter
Uses Phalcon\Contracts\Auth\AuthUser · Phalcon\Contracts\Auth\RememberToken
Method Summary¶
public RememberToken createRememberToken( AuthUser $user ) Create and persist a new remember token for the user. public AuthUser|null retrieveByToken(mixed $id,string $token,string $userAgent = null) Retrieve a user by the remember-me cookie payload. Methods¶
createRememberToken()¶
Create and persist a new remember token for the user.
retrieveByToken()¶
public function retrieveByToken(
mixed $id,
string $token,
string $userAgent = null
): AuthUser|null;
Retrieve a user by the remember-me cookie payload.
Contracts\Auth\AuthRemember¶
Interface Source on GitHub
Implemented by authenticatable models that support remember-me tokens. This is intentionally separate from AuthUser so that adapters which do not support remember-me are not forced to implement it.
Phalcon\Contracts\Auth\AuthRemember
Method Summary¶
public RememberToken createRememberToken(string $token,string $userAgent = null) Persists a new remember token for the user. public RememberToken|null getRememberToken( string $token ) Returns the remember token entry matching the given token value, Methods¶
createRememberToken()¶
Persists a new remember token for the user.
getRememberToken()¶
Returns the remember token entry matching the given token value, or null if not found.
Contracts\Auth\AuthUser¶
Interface Source on GitHub
Implemented by user models that can be authenticated.
Phalcon\Contracts\Auth\AuthUser
Method Summary¶
public int|string getAuthIdentifier() Returns the unique identifier for the authenticatable user public string getAuthPassword() Returns the hashed password for the authenticatable user. Methods¶
getAuthIdentifier()¶
Returns the unique identifier for the authenticatable user (e.g. the primary key). Implementations MUST return a non-null scalar; if a record cannot produce one, the implementation should fail at construction time rather than returning null.
getAuthPassword()¶
Returns the hashed password for the authenticatable user.
Contracts\Auth\Guard\BasicAuth¶
Interface Source on GitHub
Phalcon\Contracts\Auth\Guard\BasicAuth
Uses Phalcon\Contracts\Auth\AuthUser
Method Summary¶
public bool basic(string $field = "email",array $extraConditions = []) Authenticate against HTTP Basic credentials. Returns true on success. public false|AuthUser onceBasic(string $field = "email",array $extraConditions = []) Like basic() but does not persist; returns the resolved user on success Methods¶
basic()¶
Authenticate against HTTP Basic credentials. Returns true on success.
onceBasic()¶
Like basic() but does not persist; returns the resolved user on success or false on failure.
Contracts\Auth\Guard\Guard¶
Interface Source on GitHub
Phalcon\Contracts\Auth\Guard\Guard
Uses Phalcon\Contracts\Auth\Adapter\Adapter · Phalcon\Contracts\Auth\AuthUser · Phalcon\Contracts\Container\Service\Collection · Phalcon\Di\DiInterface
Method Summary¶
public bool check() Whether the current request is authenticated. public static fromOptions(Adapter $adapter,mixed $container,array $options) Build a guard from an adapter, the application container, and a flat public AuthUser|null getLastUserAttempted() Returns the last user the guard tried to authenticate during this public bool guest() Whether the current request is unauthenticated. public bool hasUser() Whether the guard currently holds a resolved user. public int|string|null id() Returns the authenticated user's identifier, or null when no public static setUser( AuthUser $user ) Sets the current user explicitly. Returns $this for fluent chaining. public AuthUser|null user() Returns the resolved user for the current request, or null. public bool validate( array $credentials = [] ) Validates the given credentials without logging in. Methods¶
check()¶
Whether the current request is authenticated.
fromOptions()¶
Build a guard from an adapter, the application container, and a flat options map. Used by ManagerFactory to wire guards from the application config; each implementation resolves the framework services it needs from the container.
The container is Container-first: pass a Phalcon\Container\Container. The legacy Phalcon\Di\Di is also supported with provisions - its service definitions must be pre-registered (no autowiring).
getLastUserAttempted()¶
Returns the last user the guard tried to authenticate during this request, regardless of success.
guest()¶
Whether the current request is unauthenticated.
hasUser()¶
Whether the guard currently holds a resolved user.
id()¶
Returns the authenticated user's identifier, or null when no authenticated user is present.
setUser()¶
Sets the current user explicitly. Returns $this for fluent chaining.
user()¶
Returns the resolved user for the current request, or null.
validate()¶
Validates the given credentials without logging in.
Contracts\Auth\Guard\GuardConfig¶
Interface Source on GitHub
Authentication guard configuration contract.
Per-guard config shape is intentionally guard-specific (e.g. Token exposes getInputKey()/getStorageKey(); Session has no required config today). The contract carries no methods of its own - it only marks the type so AbstractGuard can accept any guard config uniformly.
Phalcon\Contracts\Auth\Guard\GuardConfig
Contracts\Auth\Guard\GuardStateful¶
Interface Source on GitHub
Implemented by guards backed by persistent state (sessions/cookies).
Phalcon\Contracts\Auth\Guard\GuardStateful
Uses Phalcon\Contracts\Auth\Adapter\Adapter · Phalcon\Contracts\Auth\AuthUser
Method Summary¶
public bool attempt(array $credentials = [],bool $remember = false) Attempts to authenticate the user with the given credentials and, on public void login(AuthUser $user,bool $remember = false) public false|AuthUser loginById(mixed $id,bool $remember = false) Logs in the user identified by $id. Returns the resolved user on public void logout() public bool viaRemember() Methods¶
attempt()¶
Attempts to authenticate the user with the given credentials and, on success, persists the resulting state on the guard.
login()¶
loginById()¶
Logs in the user identified by $id. Returns the resolved user on success or false when no user matches the id.
logout()¶
viaRemember()¶
Contracts\Auth\Manager¶
Interface Source on GitHub
Phalcon\Contracts\Auth\Manager
Uses Phalcon\Auth\Exception · Phalcon\Contracts\Auth\Access\Access · Phalcon\Contracts\Auth\Adapter\Adapter · Phalcon\Contracts\Auth\Guard\Guard
Method Summary¶
public self access( string $accessName ) Activates the named access gate for the current request and returns the public self addAccessList( array $accessList ) public self addGuard(string $nameGuard,Guard $guard,bool $isDefault = false) public bool attempt(array $credentials = [],bool $remember = false) public bool check() Whether the default guard reports the current request as authenticated. public self except( string $actions ) Restricts the active access gate to skip the listed action names. public Access|null getAccess() Returns the active access gate, or null when none has been activated - public array getAccessList() public Guard|null getDefaultGuard() public array getGuards() public Guard guard( string $name = null ) Returns the named guard, or the default guard when $name is null. public int|string|null id() Returns the authenticated user's identifier from the default guard, public void logout() Logs the current user out via the default guard. public self only( string $actions ) Restricts the active access gate to apply only to the listed action names. public self setAccess( Access $access ) public self setDefaultGuard( Guard $guard ) public AuthUser|null user() Returns the resolved user from the default guard, or null. public bool validate( array $credentials = [] ) Validates the given credentials against the default guard without Methods¶
access()¶
Activates the named access gate for the current request and returns the manager for fluent only()/except() configuration.
Enforcement is opt-in and fail-open: when no access has been activated (getAccess() returns null) every dispatch is allowed. An activated gate stays active for subsequent dispatches in the same request (forwards, nested handlers) until it is replaced. Under classic FPM this is scoped to a single request; long-running runtimes must reset it per request.
addAccessList()¶
addGuard()¶
attempt()¶
check()¶
Whether the default guard reports the current request as authenticated.
except()¶
Restricts the active access gate to skip the listed action names.
getAccess()¶
Returns the active access gate, or null when none has been activated - in which case listener enforcement is a no-op (see access()).
getAccessList()¶
getDefaultGuard()¶
getGuards()¶
guard()¶
Returns the named guard, or the default guard when $name is null.
id()¶
Returns the authenticated user's identifier from the default guard, or null when no authenticated user is present.
logout()¶
Logs the current user out via the default guard.
only()¶
Restricts the active access gate to apply only to the listed action names.
setAccess()¶
setDefaultGuard()¶
user()¶
Returns the resolved user from the default guard, or null.
validate()¶
Validates the given credentials against the default guard without logging in.
Contracts\Auth\RememberToken¶
Interface Source on GitHub
A persisted remember-me token row.
Phalcon\Contracts\Auth\RememberToken
Method Summary¶
public bool delete() Deletes the token from storage. public string getToken() Returns the token value stored for this remember entry. public string|null getUserAgent() Returns the user agent associated with this token, if any. Methods¶
delete()¶
Deletes the token from storage.
getToken()¶
Returns the token value stored for this remember entry.
getUserAgent()¶
Returns the user agent associated with this token, if any.
Contracts\Cache\Cache¶
Interface Source on GitHub
Canonical contract for Phalcon\Cache\Cache.
Phalcon\Contracts\Cache\Cache
Uses DateInterval · Phalcon\Cache\Exception\InvalidArgumentException
Method Summary¶
public bool clear() Wipes clean the entire cache's keys. public bool delete( string $key ) Delete an item from the cache by its unique key. public bool deleteMultiple( mixed $keys ) Deletes multiple cache items in a single operation. public get(string $key,mixed $defaultValue = null) Fetches a value from the cache. public getMultiple(mixed $keys,mixed $defaultValue = null) Obtains multiple cache items by their unique keys. public bool has( string $key ) Determines whether an item is present in the cache. public bool set(string $key,mixed $value,mixed $ttl = null) Persists data in the cache, uniquely referenced by a key with an optional public bool setMultiple(mixed $values,mixed $ttl = null) Persists a set of key => value pairs in the cache, with an optional TTL. Methods¶
clear()¶
Wipes clean the entire cache's keys.
delete()¶
Delete an item from the cache by its unique key.
deleteMultiple()¶
Deletes multiple cache items in a single operation.
get()¶
Fetches a value from the cache.
getMultiple()¶
Obtains multiple cache items by their unique keys.
has()¶
Determines whether an item is present in the cache.
set()¶
Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
setMultiple()¶
Persists a set of key => value pairs in the cache, with an optional TTL.
Contracts\Cli\Dispatcher¶
Interface Source on GitHub
Canonical contract for Phalcon\Cli\Dispatcher.
Phalcon\Contracts\Dispatcher\DispatcherPhalcon\Contracts\Cli\Dispatcher
Uses Phalcon\Cli\TaskInterface · Phalcon\Contracts\Dispatcher\Dispatcher
Method Summary¶
public TaskInterface getActiveTask() Returns the active task in the dispatcher public TaskInterface getLastTask() Returns the latest dispatched controller public array getOptions() Get dispatched options public string getTaskName() Gets last dispatched task name public string getTaskSuffix() Gets default task suffix public void setDefaultTask( string $taskName ) Sets the default task name public void setOptions( array $options ) Set the options to be dispatched public void setTaskName( string $taskName ) Sets the task name to be dispatched public void setTaskSuffix( string $taskSuffix ) Sets the default task suffix Methods¶
getActiveTask()¶
Returns the active task in the dispatcher
getLastTask()¶
Returns the latest dispatched controller
getOptions()¶
Get dispatched options
getTaskName()¶
Gets last dispatched task name
getTaskSuffix()¶
Gets default task suffix
setDefaultTask()¶
Sets the default task name
setOptions()¶
Set the options to be dispatched
setTaskName()¶
Sets the task name to be dispatched
setTaskSuffix()¶
Sets the default task suffix
Contracts\Container\Ioc\IocContainer¶
Interface Source on GitHub
[IocContainer][] affords obtaining services by name.
-
Notes:
- This interface does not afford service management. The container will need to obtain services somehow, e.g. from a [Service-Interop][] implementation.
Phalcon\Contracts\Container\Ioc\IocContainer
Method Summary¶
public object getService( string $serviceName ) Returns an instance of the $serviceName. public bool hasService( string $serviceName ) Is the container able to return an instance of the $serviceName? Methods¶
getService()¶
Returns an instance of the $serviceName.
-
Directives:
- Implementations MUST throw [IocThrowable][] if the container cannot return an instance of the
$serviceName.
- Implementations MUST throw [IocThrowable][] if the container cannot return an instance of the
-
Notes:
-
The logic for this method is expressly unspecified. Retrieval may be accomplished via a service management subsystem, or by some other means.
-
The returned instance may be new or shared. The retrieval logic defines the service lifetime, not the container (per se) and not the caller requesting the service.
-
hasService()¶
Is the container able to return an instance of the $serviceName?
-
Notes:
- The logic for this method is expressly unspecified. The ability check may be accomplished by querying a service management subsystem, or by some other means.
Contracts\Container\Ioc\IocContainerFactory¶
Interface Source on GitHub
[IocContainerFactory][] affords obtaining a new instance of [IocContainer][].
Phalcon\Contracts\Container\Ioc\IocContainerFactory
Method Summary¶
Methods¶
newContainer()¶
Returns a new instance of [IocContainer][].
-
Notes:
- Container instantiation logic is not specified. Implementations might use providers, configuration files, attribute or annotation collection, or some other means to create and populate a container. Implementations might also choose to return a compiled or otherwise reconstituted container.
Contracts\Container\Ioc\IocThrowable¶
Interface Source on GitHub
[IocThrowable][] extends [Throwable][] to mark an [Exception][] as IOC-related.
It adds no class members.
ThrowablePhalcon\Contracts\Container\Ioc\IocThrowable
Uses Throwable
Contracts\Container\Ioc\IocTypeAliases¶
Interface Source on GitHub
Phalcon\Contracts\Container\Ioc\IocTypeAliases
Contracts\Container\Resolver\ReflectionMethodResolver¶
Interface Source on GitHub
Phalcon\Contracts\Container\Resolver\ReflectionMethodResolver
Uses Phalcon\Contracts\Container\Ioc\IocContainer · ReflectionMethod
Method Summary¶
Methods¶
resolveMethod()¶
public function resolveMethod(
IocContainer $ioc,
ReflectionMethod $method,
object $instance
): void;
Contracts\Container\Resolver\ReflectionParameterResolver¶
Interface Source on GitHub
Phalcon\Contracts\Container\Resolver\ReflectionParameterResolver
Uses Phalcon\Contracts\Container\Ioc\IocContainer · ReflectionParameter
Method Summary¶
Methods¶
resolveParameter()¶
Contracts\Container\Resolver\Resolvable¶
Interface Source on GitHub
Phalcon\Contracts\Container\Resolver\Resolvable
Uses Phalcon\Contracts\Container\Ioc\IocContainer
Method Summary¶
Methods¶
resolve()¶
Contracts\Container\Resolver\ResolverService¶
Interface Source on GitHub
Phalcon\Contracts\Container\Resolver\ReflectionParameterResolverPhalcon\Contracts\Container\Resolver\ResolverService
Uses Phalcon\Contracts\Container\Ioc\IocContainer · ReflectionMethod · ReflectionParameter · ReflectionType
Method Summary¶
public bool isResolvableClass( string $className ) public mixed resolveCall(IocContainer $ioc,callable $callableObject,array $arguments) public object resolveClass(IocContainer $ioc,string $className,array $arguments) public void resolveMethod(IocContainer $ioc,ReflectionMethod $method,object $instance) public array resolveParameters(IocContainer $ioc,array $parameters,array $arguments) public mixed resolveType(IocContainer $ioc,ReflectionType $type) Methods¶
isResolvableClass()¶
resolveCall()¶
public function resolveCall(
IocContainer $ioc,
callable $callableObject,
array $arguments
): mixed;
resolveClass()¶
resolveMethod()¶
public function resolveMethod(
IocContainer $ioc,
ReflectionMethod $method,
object $instance
): void;
resolveParameters()¶
resolveType()¶
Contracts\Container\Resolver\ResolverThrowable¶
Interface Source on GitHub
ThrowablePhalcon\Contracts\Container\Resolver\ResolverThrowable
Uses Throwable
Contracts\Container\Service\Collection¶
Interface Source on GitHub
Phalcon\Contracts\Container\Ioc\IocContainerPhalcon\Contracts\Container\Service\Collection
Uses Closure · Phalcon\Container\Definition\ServiceDefinition · Phalcon\Container\Resolver\Resolver · Phalcon\Contracts\Container\Ioc\IocContainer
Method Summary¶
public ServiceDefinition bind(string $interfaceName,string $concrete) public Closure callableGet( string $name ) public Closure callableNew( string $name ) public void extend(string $name,callable $callableObject) public mixed get( string $name ) public string getAlias( string $name ) public array getByTag( string $tag ) public ServiceDefinition getDefinition( string $name ) public object getInstance( string $name ) public mixed getParameter( string $name ) public Resolver getResolver() public bool has( string $name ) public bool hasAlias( string $name ) public bool hasDefinition( string $name ) public bool hasInstance( string $name ) public bool hasParameter( string $name ) public bool isAutowireEnabled() public mixed new( string $name ) public ServiceDefinition newDefinition( string $name ) public ServiceDefinition set(string $name,mixed $definition) public static setAlias(string $name,string $alias) public static setAutowire( bool $enabled ) public static setDefinition(string $name,ServiceDefinition $definition) public static setInstance(string $name,object $instance,string $lifetime) public static setParameter(string $name,mixed $value) public void unsetAlias( string $name ) public void unsetDefinition( string $name ) public void unsetInstance( string $name ) public void unsetInstances( string $lifetime ) public void unsetParameter( string $name ) Methods¶
bind()¶
callableGet()¶
callableNew()¶
extend()¶
get()¶
getAlias()¶
getByTag()¶
getDefinition()¶
getInstance()¶
getParameter()¶
getResolver()¶
has()¶
hasAlias()¶
hasDefinition()¶
hasInstance()¶
hasParameter()¶
isAutowireEnabled()¶
new()¶
newDefinition()¶
set()¶
setAlias()¶
setAutowire()¶
setDefinition()¶
setInstance()¶
setParameter()¶
unsetAlias()¶
unsetDefinition()¶
unsetInstance()¶
unsetInstances()¶
unsetParameter()¶
Contracts\Container\Service\Definition¶
Interface Source on GitHub
Phalcon\Contracts\Container\Service\Definition
Uses Phalcon\Contracts\Container\Ioc\IocContainer
Method Summary¶
public static addExtender( callable $extender ) public object buildService( IocContainer $ioc ) public string getClass() public array getExtenders() public callable getFactory() public string getLifetime() public string getServiceName() public bool hasClass() public bool hasExtenders() public bool hasFactory() public static setClass( string $className ) public static setExtenders( array $extenders ) public static setFactory( callable $factory ) public static setLifetime( string $lifetime ) public static unsetClass() public static unsetExtenders() public static unsetFactory() Methods¶
addExtender()¶
buildService()¶
getClass()¶
getExtenders()¶
getFactory()¶
getLifetime()¶
getServiceName()¶
hasClass()¶
hasExtenders()¶
hasFactory()¶
setClass()¶
setExtenders()¶
setFactory()¶
setLifetime()¶
unsetClass()¶
unsetExtenders()¶
unsetFactory()¶
Contracts\Container\Service\Provider¶
Interface Source on GitHub
Phalcon\Contracts\Container\Service\Provider
Method Summary¶
Methods¶
provide()¶
Contracts\Container\Service\Throwable¶
Interface Source on GitHub
PhpThrowablePhalcon\Contracts\Container\Service\Throwable
Uses Throwable
Contracts\Db\Adapter\Adapter¶
Interface Source on GitHub
Canonical contract for Phalcon\Db adapters.
@todo v7 - these will become required interface members. They are omitted from the v5 line to avoid breaking third-party implementors: - addCheck() : bool - createMaterializedView() : bool - dropCheck() : bool - dropMaterializedView() : bool - onConflictUpdate() : string - refreshMaterializedView() : bool - returning() : string
Phalcon\Contracts\Db\Adapter\Adapter
Uses Phalcon\Db\ColumnInterface · Phalcon\Db\DialectInterface · Phalcon\Db\IndexInterface · Phalcon\Db\RawValue · Phalcon\Db\ReferenceInterface · Phalcon\Db\ResultInterface
Method Summary¶
public bool addColumn(string $tableName,string $schemaName,ColumnInterface $column) Adds a column to a table public bool addForeignKey(string $tableName,string $schemaName,ReferenceInterface $reference) Adds a foreign key to a table public bool addIndex(string $tableName,string $schemaName,IndexInterface $index) Adds an index to a table public bool addPrimaryKey(string $tableName,string $schemaName,IndexInterface $index) Adds a primary key to a table public int affectedRows() Returns the number of affected rows by the last INSERT/UPDATE/DELETE public bool begin( bool $nesting = true ) Starts a transaction in the connection public void close() Closes active connection returning success. Phalcon automatically closes public bool commit( bool $nesting = true ) Commits the active transaction in the connection public void connect( array $descriptor = [] ) This method is automatically called in \Phalcon\Db\Adapter\Pdo public bool createSavepoint( string $name ) Creates a new savepoint public bool createTable(string $tableName,string $schemaName,array $definition) Creates a table public bool createView(string $viewName,array $definition,string $schemaName = null) Creates a view public bool delete(mixed $table,string $whereCondition = null,array $placeholders = [],array $dataTypes = []) Deletes data from a table using custom RDBMS SQL syntax public ColumnInterface[] describeColumns(string $table,string $schema = null) Returns an array of Phalcon\Db\Column objects describing a table public IndexInterface[] describeIndexes(string $table,string $schema = null) Lists table indexes public ReferenceInterface[] describeReferences(string $table,string $schema = null) Lists table references public bool dropColumn(string $tableName,string $schemaName,string $columnName) Drops a column from a table public bool dropForeignKey(string $tableName,string $schemaName,string $referenceName) Drops a foreign key from a table public bool dropIndex(string $tableName,string $schemaName,string $indexName) Drop an index from a table public bool dropPrimaryKey(string $tableName,string $schemaName) Drops primary key from a table public bool dropTable(string $tableName,string $schemaName = null,bool $ifExists = true) Drops a table from a schema/database public bool dropView(string $viewName,string $schemaName = null,bool $ifExists = true) Drops a view public string escapeIdentifier( mixed $identifier ) Escapes a column/table/schema name public string escapeString( string $str ) Escapes a value to avoid SQL injections public bool execute(string $sqlStatement,array $bindParams = [],array $bindTypes = []) Sends SQL statements to the database server returning the success state. public array fetchAll(string $sqlQuery,int $fetchMode = 2,array $bindParams = [],array $bindTypes = []) Dumps the complete result of a query into an array public string|bool fetchColumn(string $sqlQuery,array $placeholders = [],mixed $column = 0) Returns the n'th field of first row in a SQL query result public array fetchOne(string $sqlQuery,int $fetchMode = 2,array $bindParams = [],array $bindTypes = []) Returns the first row in a SQL query result public string forUpdate(string $sqlQuery,string $modifier = "") Returns a SQL modified with a FOR UPDATE clause. The optional modifier public string getColumnDefinition( ColumnInterface $column ) Returns the SQL column definition from a column public string getColumnList( mixed $columnList ) Gets a list of columns public int getConnectionId() Gets the active connection unique identifier public RawValue getDefaultIdValue() Return the default identity value to insert in an identity column public RawValue|null getDefaultValue() Returns the default value to make the RBDM use the default value declared public array getDescriptor() Return descriptor used to connect to the active database public DialectInterface getDialect() Returns internal dialect instance public string getDialectType() Returns the name of the dialect used public mixed getInternalHandler() Return internal PDO handler public string getNestedTransactionSavepointName() Returns the savepoint name to use for nested transactions public string getRealSQLStatement() Active SQL statement in the object without replace bound parameters public array getSQLBindTypes() Active SQL statement in the object public string getSQLStatement() Active SQL statement in the object public array getSQLVariables() Active SQL statement in the object public string getType() Returns type of database system the adapter is used for public bool insert(string $table,array $values,mixed $fields = null,mixed $dataTypes = null) Inserts data into a table using custom RDBMS SQL syntax public bool insertAsDict(string $table,mixed $data,mixed $dataTypes = null) Inserts data into a table using custom RBDM SQL syntax public bool isNestedTransactionsWithSavepoints() Returns if nested transactions should use savepoints public bool isUnderTransaction() Checks whether connection is under database transaction public string|bool lastInsertId( string $name = null ) Returns insert id for the auto_increment column inserted in the last SQL public string limit(string $sqlQuery,mixed $number) Appends a LIMIT clause to sqlQuery argument public array listTables( string $schemaName = null ) List all tables on a database public array listViews( string $schemaName = null ) List all views on a database public bool modifyColumn(string $tableName,string $schemaName,ColumnInterface $column,ColumnInterface $currentColumn = null) Modifies a table column based on a definition public ResultInterface|bool query(string $sqlStatement,array $bindParams = [],array $bindTypes = []) Sends SQL statements to the database server returning the success state. public bool releaseSavepoint( string $name ) Releases given savepoint public bool rollback( bool $nesting = true ) Rollbacks the active transaction in the connection public bool rollbackSavepoint( string $name ) Rollbacks given savepoint public \Phalcon\Db\Adapter\AdapterInterface setNestedTransactionsWithSavepoints( bool $nestedTransactionsWithSavepoints ) Set if nested transactions should use savepoints public string sharedLock(string $sqlQuery,string $modifier = "") Returns a SQL modified with a shared-lock clause. See the dialect's public bool supportSequences() Check whether the database system requires a sequence to produce public bool supportsDefaultValue() SQLite does not support the DEFAULT keyword public bool tableExists(string $tableName,string $schemaName = null) Generates SQL checking for the existence of a schema.table public array tableOptions(string $tableName,string $schemaName = null) Gets creation options from a table public bool update(string $table,mixed $fields,mixed $values,mixed $whereCondition = null,mixed $dataTypes = null) Updates data on a table using custom RDBMS SQL syntax public bool updateAsDict(string $table,mixed $data,mixed $whereCondition = null,mixed $dataTypes = null) Updates data on a table using custom RBDM SQL syntax public bool useExplicitIdValue() Check whether the database system requires an explicit value for identity public bool viewExists(string $viewName,string $schemaName = null) Generates SQL checking for the existence of a schema.view Methods¶
addColumn()¶
Adds a column to a table
addForeignKey()¶
public function addForeignKey(
string $tableName,
string $schemaName,
ReferenceInterface $reference
): bool;
Adds a foreign key to a table
addIndex()¶
Adds an index to a table
addPrimaryKey()¶
public function addPrimaryKey(
string $tableName,
string $schemaName,
IndexInterface $index
): bool;
Adds a primary key to a table
affectedRows()¶
Returns the number of affected rows by the last INSERT/UPDATE/DELETE reported by the database system
begin()¶
Starts a transaction in the connection
close()¶
Closes active connection returning success. Phalcon automatically closes and destroys active connections within Phalcon\Db\Pool
commit()¶
Commits the active transaction in the connection
connect()¶
This method is automatically called in \Phalcon\Db\Adapter\Pdo constructor. Call it when you need to restore a database connection
createSavepoint()¶
Creates a new savepoint
createTable()¶
Creates a table
createView()¶
Creates a view
delete()¶
public function delete(
mixed $table,
string $whereCondition = null,
array $placeholders = [],
array $dataTypes = []
): bool;
Deletes data from a table using custom RDBMS SQL syntax
describeColumns()¶
Returns an array of Phalcon\Db\Column objects describing a table
describeIndexes()¶
Lists table indexes
describeReferences()¶
Lists table references
dropColumn()¶
Drops a column from a table
dropForeignKey()¶
public function dropForeignKey(
string $tableName,
string $schemaName,
string $referenceName
): bool;
Drops a foreign key from a table
dropIndex()¶
Drop an index from a table
dropPrimaryKey()¶
Drops primary key from a table
dropTable()¶
public function dropTable(
string $tableName,
string $schemaName = null,
bool $ifExists = true
): bool;
Drops a table from a schema/database
dropView()¶
public function dropView(
string $viewName,
string $schemaName = null,
bool $ifExists = true
): bool;
Drops a view
escapeIdentifier()¶
Escapes a column/table/schema name
escapeString()¶
Escapes a value to avoid SQL injections
execute()¶
public function execute(
string $sqlStatement,
array $bindParams = [],
array $bindTypes = []
): bool;
Sends SQL statements to the database server returning the success state. Use this method only when the SQL statement sent to the server does not return any rows
fetchAll()¶
public function fetchAll(
string $sqlQuery,
int $fetchMode = 2,
array $bindParams = [],
array $bindTypes = []
): array;
Dumps the complete result of a query into an array
fetchColumn()¶
public function fetchColumn(
string $sqlQuery,
array $placeholders = [],
mixed $column = 0
): string|bool;
Returns the n'th field of first row in a SQL query result
// Getting count of robots
$robotsCount = $connection->fetchColumn("SELECT COUNT(*) FROM robots");
print_r($robotsCount);
// Getting name of last edited robot
$robot = $connection->fetchColumn(
"SELECT id, name FROM robots ORDER BY modified DESC",
1
);
print_r($robot);
fetchOne()¶
public function fetchOne(
string $sqlQuery,
int $fetchMode = 2,
array $bindParams = [],
array $bindTypes = []
): array;
Returns the first row in a SQL query result
forUpdate()¶
Returns a SQL modified with a FOR UPDATE clause. The optional modifier appends a row-lock disposition keyword - pass Dialect::LOCK_NOWAIT or Dialect::LOCK_SKIP_LOCKED (or leave as Dialect::LOCK_NONE).
getColumnDefinition()¶
Returns the SQL column definition from a column
getColumnList()¶
Gets a list of columns
getConnectionId()¶
Gets the active connection unique identifier
getDefaultIdValue()¶
Return the default identity value to insert in an identity column
getDefaultValue()¶
Returns the default value to make the RBDM use the default value declared in the table definition
// Inserting a new robot with a valid default value for the column 'year'
$success = $connection->insert(
"robots",
[
"Astro Boy",
$connection->getDefaultValue()
],
[
"name",
"year",
]
);
@todo Return NULL if this is not supported by the adapter
getDescriptor()¶
Return descriptor used to connect to the active database
getDialect()¶
Returns internal dialect instance
getDialectType()¶
Returns the name of the dialect used
getInternalHandler()¶
Return internal PDO handler
getNestedTransactionSavepointName()¶
Returns the savepoint name to use for nested transactions
getRealSQLStatement()¶
Active SQL statement in the object without replace bound parameters
getSQLBindTypes()¶
Active SQL statement in the object
getSQLStatement()¶
Active SQL statement in the object
getSQLVariables()¶
Active SQL statement in the object
getType()¶
Returns type of database system the adapter is used for
insert()¶
public function insert(
string $table,
array $values,
mixed $fields = null,
mixed $dataTypes = null
): bool;
Inserts data into a table using custom RDBMS SQL syntax
insertAsDict()¶
Inserts data into a table using custom RBDM SQL syntax
// Inserting a new robot
$success = $connection->insertAsDict(
"robots",
[
"name" => "Astro Boy",
"year" => 1952,
]
);
// Next SQL sentence is sent to the database system
INSERT INTO `robots` (`name`, `year`) VALUES ("Astro boy", 1952);
isNestedTransactionsWithSavepoints()¶
Returns if nested transactions should use savepoints
isUnderTransaction()¶
Checks whether connection is under database transaction
lastInsertId()¶
Returns insert id for the auto_increment column inserted in the last SQL statement
limit()¶
Appends a LIMIT clause to sqlQuery argument
listTables()¶
List all tables on a database
listViews()¶
List all views on a database
modifyColumn()¶
public function modifyColumn(
string $tableName,
string $schemaName,
ColumnInterface $column,
ColumnInterface $currentColumn = null
): bool;
Modifies a table column based on a definition
query()¶
public function query(
string $sqlStatement,
array $bindParams = [],
array $bindTypes = []
): ResultInterface|bool;
Sends SQL statements to the database server returning the success state. Use this method only when the SQL statement sent to the server returns rows
releaseSavepoint()¶
Releases given savepoint
rollback()¶
Rollbacks the active transaction in the connection
rollbackSavepoint()¶
Rollbacks given savepoint
setNestedTransactionsWithSavepoints()¶
public function setNestedTransactionsWithSavepoints( bool $nestedTransactionsWithSavepoints ): \Phalcon\Db\Adapter\AdapterInterface;
Set if nested transactions should use savepoints
sharedLock()¶
Returns a SQL modified with a shared-lock clause. See the dialect's sharedLock() for per-engine semantics. The optional modifier is passed straight through (use Dialect::LOCK_NOWAIT / Dialect::LOCK_SKIP_LOCKED for PostgreSQL).
supportSequences()¶
Check whether the database system requires a sequence to produce auto-numeric values
supportsDefaultValue()¶
SQLite does not support the DEFAULT keyword
tableExists()¶
Generates SQL checking for the existence of a schema.table
tableOptions()¶
Gets creation options from a table
update()¶
public function update(
string $table,
mixed $fields,
mixed $values,
mixed $whereCondition = null,
mixed $dataTypes = null
): bool;
Updates data on a table using custom RDBMS SQL syntax
updateAsDict()¶
public function updateAsDict(
string $table,
mixed $data,
mixed $whereCondition = null,
mixed $dataTypes = null
): bool;
Updates data on a table using custom RBDM SQL syntax Another, more convenient syntax
// Updating existing robot
$success = $connection->updateAsDict(
"robots",
[
"name" => "New Astro Boy",
],
"id = 101"
);
// Next SQL sentence is sent to the database system
UPDATE `robots` SET `name` = "Astro boy" WHERE id = 101
useExplicitIdValue()¶
Check whether the database system requires an explicit value for identity columns
viewExists()¶
Generates SQL checking for the existence of a schema.view
Contracts\Db\Check¶
Interface Source on GitHub
Canonical contract for Phalcon\Db\Check.
Phalcon\Contracts\Db\Check
Method Summary¶
public string getExpression() Gets the CHECK expression (the SQL boolean predicate). public string getName() Gets the constraint name. An empty string indicates an unnamed CHECK Methods¶
getExpression()¶
Gets the CHECK expression (the SQL boolean predicate).
getName()¶
Gets the constraint name. An empty string indicates an unnamed CHECK constraint - the dialect will emit the clause without a CONSTRAINT prefix in that case.
Contracts\Db\Column¶
Interface Source on GitHub
Canonical contract for Phalcon\Db\Column.
@todo v7 - these will become required interface members. They are omitted from the v5 line to avoid breaking third-party implementors: - getGenerationExpression() : string | null - isArray() : bool - isGenerated() : bool - isGenerationStored() : bool - isInvisible() : bool
Phalcon\Contracts\Db\Column
Method Summary¶
public string|null getAfterPosition() Check whether field absolute to position in table public int getBindType() Returns the type of bind handling public mixed getDefault() Returns default value of column public string getName() Returns column name public int getScale() Returns column scale public int|string getSize() Returns column size public int|string getType() Returns column type public int getTypeReference() Returns column type reference public array|string|int getTypeValues() Returns column type values public bool hasDefault() Check whether column has default value public bool isAutoIncrement() Auto-Increment public bool isFirst() Check whether column have first position in table public bool isNotNull() Not null public bool isNumeric() Check whether column have an numeric type public bool isPrimary() Column is part of the primary key? public bool isUnsigned() Returns true if number column is unsigned Methods¶
getAfterPosition()¶
Check whether field absolute to position in table
getBindType()¶
Returns the type of bind handling
getDefault()¶
Returns default value of column
getName()¶
Returns column name
getScale()¶
Returns column scale
getSize()¶
Returns column size
getType()¶
Returns column type
getTypeReference()¶
Returns column type reference
getTypeValues()¶
Returns column type values
hasDefault()¶
Check whether column has default value
isAutoIncrement()¶
Auto-Increment
isFirst()¶
Check whether column have first position in table
isNotNull()¶
Not null
isNumeric()¶
Check whether column have an numeric type
isPrimary()¶
Column is part of the primary key?
isUnsigned()¶
Returns true if number column is unsigned
Contracts\Db\Dialect¶
Interface Source on GitHub
Canonical contract for Phalcon\Db dialects.
@todo v7 - these will become required interface members. They are omitted from the v5 line to avoid breaking third-party implementors: - addCheck() : string - createMaterializedView() : string - dropCheck() : string - dropMaterializedView() : string - onConflictUpdate() : string - refreshMaterializedView() : string - returning() : string
Phalcon\Contracts\Db\Dialect
Uses Phalcon\Db\ColumnInterface · Phalcon\Db\IndexInterface · Phalcon\Db\ReferenceInterface
Method Summary¶
public string addColumn(string $tableName,string $schemaName,ColumnInterface $column) Generates SQL to add a column to a table public string addForeignKey(string $tableName,string $schemaName,ReferenceInterface $reference) Generates SQL to add an index to a table public string addIndex(string $tableName,string $schemaName,IndexInterface $index) Generates SQL to add an index to a table public string addPrimaryKey(string $tableName,string $schemaName,IndexInterface $index) Generates SQL to add the primary key to a table public string createSavepoint( string $name ) Generate SQL to create a new savepoint public string createTable(string $tableName,string $schemaName,array $definition) Generates SQL to create a table public string createView(string $viewName,array $definition,string $schemaName = null) Generates SQL to create a view public string describeColumns(string $table,string $schema = null) Generates SQL to describe a table public string describeIndexes(string $table,string $schema = null) Generates SQL to query indexes on a table. public string describeReferences(string $table,string $schema = null) Generates SQL to query foreign keys on a table. public string dropColumn(string $tableName,string $schemaName,string $columnName) Generates SQL to delete a column from a table public string dropForeignKey(string $tableName,string $schemaName,string $referenceName) Generates SQL to delete a foreign key from a table public string dropIndex(string $tableName,string $schemaName,string $indexName) Generates SQL to delete an index from a table public string dropPrimaryKey(string $tableName,string $schemaName) Generates SQL to delete primary key from a table public string dropTable(string $tableName,string $schemaName,bool $ifExists = true) Generates SQL to drop a table public string dropView(string $viewName,string $schemaName = null,bool $ifExists = true) Generates SQL to drop a view public string forUpdate(string $sqlQuery,string $modifier = "") Returns a SQL modified with a FOR UPDATE clause. The optional modifier public string getColumnDefinition( ColumnInterface $column ) Gets the column name in RDBMS public string getColumnList( array $columnList ) Gets a list of columns public array getCustomFunctions() Returns registered functions public string getSqlExpression(array $expression,string $escapeChar = null,array $bindCounts = []) Transforms an intermediate representation for an expression into a public string limit(string $sqlQuery,mixed $number) Generates the SQL for LIMIT clause public string listTables( string $schemaName = null ) List all tables in database public string modifyColumn(string $tableName,string $schemaName,ColumnInterface $column,ColumnInterface $currentColumn = null) Generates SQL to modify a column in a table public \Phalcon\Db\Dialect registerCustomFunction(string $name,callable $customFunction) Registers custom SQL functions public string releaseSavepoint( string $name ) Generate SQL to release a savepoint public string rollbackSavepoint( string $name ) Generate SQL to rollback a savepoint public string select( array $definition ) Builds a SELECT statement public string sharedLock(string $sqlQuery,string $modifier = "") Returns a SQL modified with a shared-lock clause. MySQL emits public bool supportsReleaseSavepoints() Checks whether the platform supports releasing savepoints. public bool supportsSavepoints() Checks whether the platform supports savepoints public string tableExists(string $tableName,string $schemaName = null) Generates SQL checking for the existence of a schema.table public string tableOptions(string $table,string $schema = null) Generates the SQL to describe the table creation options public string viewExists(string $viewName,string $schemaName = null) Generates SQL checking for the existence of a schema.view Constants¶
string LOCK_NONE = "" No row-lock modifier - the default behavior for forUpdate(). string LOCK_NOWAIT = "NOWAIT" Append NOWAIT to the FOR UPDATE clause - the query fails immediately if a row it needs is locked instead of blocking. MySQL 8.0+ and PostgreSQL 9.5+ recognize this. SQLite has no row-level locking and silently ignores the modifier. string LOCK_SKIP_LOCKED = "SKIP LOCKED" Append SKIP LOCKED to the FOR UPDATE clause - the query returns rows that are not currently locked and silently skips ones that are. MySQL 8.0+ and PostgreSQL 9.5+ recognize this. SQLite ignores it. Methods¶
addColumn()¶
public function addColumn(
string $tableName,
string $schemaName,
ColumnInterface $column
): string;
Generates SQL to add a column to a table
addForeignKey()¶
public function addForeignKey(
string $tableName,
string $schemaName,
ReferenceInterface $reference
): string;
Generates SQL to add an index to a table
addIndex()¶
Generates SQL to add an index to a table
addPrimaryKey()¶
public function addPrimaryKey(
string $tableName,
string $schemaName,
IndexInterface $index
): string;
Generates SQL to add the primary key to a table
createSavepoint()¶
Generate SQL to create a new savepoint
createTable()¶
Generates SQL to create a table
createView()¶
public function createView(
string $viewName,
array $definition,
string $schemaName = null
): string;
Generates SQL to create a view
describeColumns()¶
Generates SQL to describe a table
describeIndexes()¶
Generates SQL to query indexes on a table.
The base adapter consumes the result as FETCH_NUM rows by position: column index 2 must be the index key name and column index 4 the indexed column name.
describeReferences()¶
Generates SQL to query foreign keys on a table.
The base adapter consumes the result as FETCH_NUM rows by position: index 1 the local column, index 2 the constraint name, index 3 the referenced schema, index 4 the referenced table, and index 5 the referenced column.
dropColumn()¶
Generates SQL to delete a column from a table
dropForeignKey()¶
public function dropForeignKey(
string $tableName,
string $schemaName,
string $referenceName
): string;
Generates SQL to delete a foreign key from a table
dropIndex()¶
Generates SQL to delete an index from a table
dropPrimaryKey()¶
Generates SQL to delete primary key from a table
dropTable()¶
Generates SQL to drop a table
dropView()¶
public function dropView(
string $viewName,
string $schemaName = null,
bool $ifExists = true
): string;
Generates SQL to drop a view
forUpdate()¶
Returns a SQL modified with a FOR UPDATE clause. The optional modifier appends a row-lock disposition keyword - pass Dialect::LOCK_NOWAIT or Dialect::LOCK_SKIP_LOCKED (or leave as Dialect::LOCK_NONE).
getColumnDefinition()¶
Gets the column name in RDBMS
getColumnList()¶
Gets a list of columns
getCustomFunctions()¶
Returns registered functions
getSqlExpression()¶
public function getSqlExpression(
array $expression,
string $escapeChar = null,
array $bindCounts = []
): string;
Transforms an intermediate representation for an expression into a database system valid expression
limit()¶
Generates the SQL for LIMIT clause
listTables()¶
List all tables in database
modifyColumn()¶
public function modifyColumn(
string $tableName,
string $schemaName,
ColumnInterface $column,
ColumnInterface $currentColumn = null
): string;
Generates SQL to modify a column in a table
registerCustomFunction()¶
public function registerCustomFunction(
string $name,
callable $customFunction
): \Phalcon\Db\Dialect;
Registers custom SQL functions
releaseSavepoint()¶
Generate SQL to release a savepoint
rollbackSavepoint()¶
Generate SQL to rollback a savepoint
select()¶
Builds a SELECT statement
sharedLock()¶
Returns a SQL modified with a shared-lock clause. MySQL emits LOCK IN SHARE MODE; PostgreSQL emits FOR SHARE; SQLite returns the original query unchanged. The optional modifier appends a row-lock disposition keyword (Dialect::LOCK_NOWAIT / Dialect::LOCK_SKIP_LOCKED) for PostgreSQL - MySQL's legacy LOCK IN SHARE MODE does not support modifiers, so non-empty values are silently ignored on MySQL.
supportsReleaseSavepoints()¶
Checks whether the platform supports releasing savepoints.
supportsSavepoints()¶
Checks whether the platform supports savepoints
tableExists()¶
Generates SQL checking for the existence of a schema.table
tableOptions()¶
Generates the SQL to describe the table creation options
viewExists()¶
Generates SQL checking for the existence of a schema.view
Contracts\Db\Geometry\Geometry¶
Interface Source on GitHub
Canonical contract for Phalcon\Db\Geometry value objects.
Phalcon\Contracts\Db\Geometry\Geometry
Method Summary¶
public int getSrid() Gets the Spatial Reference System Identifier (SRID). public int getType() Gets the geometry type. public string toWkt() Renders the geometry as a Well-Known Text (WKT) string. Methods¶
getSrid()¶
Gets the Spatial Reference System Identifier (SRID).
getType()¶
Gets the geometry type.
toWkt()¶
Renders the geometry as a Well-Known Text (WKT) string.
Contracts\Db\Index¶
Interface Source on GitHub
Canonical contract for Phalcon\Db\Index.
@todo v7 - these will become required interface members. They are omitted from the v5 line to avoid breaking third-party implementors: - getDirections() : array - getWhere() : string - isConcurrent() : bool - isInvisible() : bool
Phalcon\Contracts\Db\Index
Method Summary¶
public array getColumns() Gets the columns that corresponds the index public string getName() Gets the index name public string getType() Gets the index type Methods¶
getColumns()¶
Gets the columns that corresponds the index
getName()¶
Gets the index name
getType()¶
Gets the index type
Contracts\Db\Reference¶
Interface Source on GitHub
Canonical contract for Phalcon\Db\Reference.
Phalcon\Contracts\Db\Reference
Method Summary¶
public array getColumns() Gets local columns which reference is based public string getName() Gets the index name public string|null getOnDelete() Gets the referenced on delete public string|null getOnUpdate() Gets the referenced on update public array getReferencedColumns() Gets referenced columns public string|null getReferencedSchema() Gets the schema where referenced table is public string getReferencedTable() Gets the referenced table public string|null getSchemaName() Gets the schema where referenced table is Methods¶
getColumns()¶
Gets local columns which reference is based
getName()¶
Gets the index name
getOnDelete()¶
Gets the referenced on delete
getOnUpdate()¶
Gets the referenced on update
getReferencedColumns()¶
Gets referenced columns
getReferencedSchema()¶
Gets the schema where referenced table is
getReferencedTable()¶
Gets the referenced table
getSchemaName()¶
Gets the schema where referenced table is
Contracts\Db\Result¶
Interface Source on GitHub
Canonical contract for Phalcon\Db result objects.
Phalcon\Contracts\Db\Result
Method Summary¶
public dataSeek( int $number ) Moves internal resultset cursor to another position letting us to fetch a public bool execute() Allows to execute the statement again. Some database systems don't public mixed fetch() Fetches an array/object of strings that corresponds to the fetched row, public array fetchAll() Returns an array of arrays containing all the records in the result. This public mixed fetchArray() Returns an array of strings that corresponds to the fetched row, or FALSE public \PDOStatement getInternalResult() Gets the internal PDO result object public int numRows() Gets number of rows returned by a resultset public bool setFetchMode( int $fetchMode ) Changes the fetching mode affecting Phalcon\Db\Result\Pdo::fetch() Methods¶
dataSeek()¶
Moves internal resultset cursor to another position letting us to fetch a certain row
execute()¶
Allows to execute the statement again. Some database systems don't support scrollable cursors. So, as cursors are forward only, we need to execute the cursor again to fetch rows from the beginning
fetch()¶
Fetches an array/object of strings that corresponds to the fetched row, or FALSE if there are no more rows. This method is affected by the active fetch flag set using Phalcon\Db\Result\Pdo::setFetchMode()
fetchAll()¶
Returns an array of arrays containing all the records in the result. This method is affected by the active fetch flag set using Phalcon\Db\Result\Pdo::setFetchMode()
fetchArray()¶
Returns an array of strings that corresponds to the fetched row, or FALSE if there are no more rows. This method is affected by the active fetch flag set using Phalcon\Db\Result\Pdo::setFetchMode()
getInternalResult()¶
Gets the internal PDO result object
numRows()¶
Gets number of rows returned by a resultset
setFetchMode()¶
Changes the fetching mode affecting Phalcon\Db\Result\Pdo::fetch()
Contracts\Dispatcher\Dispatcher¶
Interface Source on GitHub
Canonical contract for Phalcon\Dispatcher\AbstractDispatcher.
Note: The deprecated getParam()/getParams()/hasParam()/setParam()/ setParams() spellings are still declared for backwards compatibility and are scheduled to be removed in the next major version in favor of their *Parameter counterparts.
Phalcon\Contracts\Dispatcher\Dispatcher
Method Summary¶
public mixed|bool dispatch() Dispatches a handle action taking into account the routing parameters public void forward( array $forward ) Forwards the execution flow to another controller/action public string getActionName() Gets last dispatched action name public string getActionSuffix() Gets the default action suffix public string getHandlerSuffix() Gets the default handler suffix public mixed getParam(mixed $param,mixed $filters = null) Gets a param by its name or numeric index public mixed getParameter(mixed $param,mixed $filters = null) Gets a param by its name or numeric index public array getParameters() Gets action params public array getParams() Gets action params public mixed getReturnedValue() Returns value returned by the latest dispatched action public bool hasParam( mixed $param ) Check if a param exists public bool isFinished() Checks if the dispatch loop is finished or has more pendent public void setActionName( string $actionName ) Sets the action name to be dispatched public void setActionSuffix( string $actionSuffix ) Sets the default action suffix public void setDefaultAction( string $actionName ) Sets the default action name public void setDefaultNamespace( string $defaultNamespace ) Sets the default namespace public void setHandlerSuffix( string $handlerSuffix ) Sets the default suffix for the handler public void setModuleName( string $moduleName = null ) Sets the module name which the application belongs to public void setNamespaceName( string $namespaceName ) Sets the namespace which the controller belongs to public void setParam(mixed $param,mixed $value) Set a param by its name or numeric index public void setParams( array $params ) Sets action params to be dispatched Methods¶
dispatch()¶
Dispatches a handle action taking into account the routing parameters
forward()¶
Forwards the execution flow to another controller/action
getActionName()¶
Gets last dispatched action name
getActionSuffix()¶
Gets the default action suffix
getHandlerSuffix()¶
Gets the default handler suffix
getParam()¶
Gets a param by its name or numeric index
Note: This signature omits the defaultValue argument the implementation accepts; the two will be aligned in the next major version.
getParameter()¶
Gets a param by its name or numeric index
getParameters()¶
Gets action params
getParams()¶
Gets action params
getReturnedValue()¶
Returns value returned by the latest dispatched action
hasParam()¶
Check if a param exists
isFinished()¶
Checks if the dispatch loop is finished or has more pendent controllers/tasks to dispatch
setActionName()¶
Sets the action name to be dispatched
setActionSuffix()¶
Sets the default action suffix
setDefaultAction()¶
Sets the default action name
setDefaultNamespace()¶
Sets the default namespace
setHandlerSuffix()¶
Sets the default suffix for the handler
setModuleName()¶
Sets the module name which the application belongs to
setNamespaceName()¶
Sets the namespace which the controller belongs to
setParam()¶
Set a param by its name or numeric index
setParams()¶
Sets action params to be dispatched
Contracts\Domain\Payload\Payload¶
Interface Source on GitHub
Canonical combined read/write contract for a domain payload.
Payload extends both Writeable and Readable, exposing the full capability set. The intended convention narrows that surface by which side of the Action-Domain-Responder boundary holds the payload: the domain layer builds the payload through Writeable (the setters), while the responder consumes the finished payload through Readable (the getters). Type-hinting against the narrower contract at each boundary keeps each side to the capability it needs, even though the concrete payload implements both.
@see Readable @see Writeable
Phalcon\Contracts\Domain\Payload\ReadablePhalcon\Contracts\Domain\Payload\Payload— extendsPhalcon\Contracts\Domain\Payload\Readable,Phalcon\Contracts\Domain\Payload\Writeable
Contracts\Domain\Payload\Readable¶
Interface Source on GitHub
Canonical read-only contract for a domain payload.
Responders consume a finished payload through this contract (the getters), narrowing the surface to the read side of the Action-Domain-Responder boundary.
Phalcon\Contracts\Domain\Payload\Readable
Uses Throwable
Method Summary¶
public Throwable|null getException() Gets the potential exception thrown in the domain layer public mixed getExtras() Gets arbitrary extra values produced by the domain layer. public mixed getInput() Gets the input received by the domain layer. public mixed getMessages() Gets the messages produced by the domain layer. public mixed getOutput() Gets the output produced from the domain layer. public mixed getStatus() Gets the status of this payload. Methods¶
getException()¶
Gets the potential exception thrown in the domain layer
getExtras()¶
Gets arbitrary extra values produced by the domain layer.
getInput()¶
Gets the input received by the domain layer.
getMessages()¶
Gets the messages produced by the domain layer.
getOutput()¶
Gets the output produced from the domain layer.
getStatus()¶
Gets the status of this payload.
Status values are drawn from the Status vocabulary.
@see \Phalcon\Domain\Payload\Status
Contracts\Domain\Payload\Writeable¶
Interface Source on GitHub
Canonical write-only contract for a domain payload.
The domain layer builds a payload through this contract (the setters), narrowing the surface to the write side of the Action-Domain-Responder boundary.
Phalcon\Contracts\Domain\Payload\Writeable
Uses Throwable
Method Summary¶
public Payload setException( Throwable $exception ) Sets an exception produced by the domain layer. public Payload setExtras( mixed $extras ) Sets arbitrary extra values produced by the domain layer. public Payload setInput( mixed $input ) Sets the input received by the domain layer. public Payload setMessages( mixed $messages ) Sets the messages produced by the domain layer. public Payload setOutput( mixed $output ) Sets the output produced from the domain layer. public Payload setStatus( mixed $status ) Sets the status of this payload. Methods¶
setException()¶
Sets an exception produced by the domain layer.
setExtras()¶
Sets arbitrary extra values produced by the domain layer.
setInput()¶
Sets the input received by the domain layer.
setMessages()¶
Sets the messages produced by the domain layer.
setOutput()¶
Sets the output produced from the domain layer.
setStatus()¶
Sets the status of this payload.
Status values are drawn from the Status vocabulary.
@see \Phalcon\Domain\Payload\Status
Contracts\Encryption\Crypt\Crypt¶
Interface Source on GitHub
Canonical contract for Phalcon\Encryption\Crypt.
The encrypted payload produced by encrypt() uses the wire format:
iv ‖ hmac ‖ ciphertext ‖ tag
where hmac is present only when signing is enabled (useSigning(true), the default) and tag is present only for AEAD ciphers (gcm/ccm).
The AEAD parameters (authData, authTag, authTagLength) are instance state set through the relevant setters and shared across every encrypt()/decrypt() call on the instance. A Crypt service shared through the DI container is therefore not safe for interleaved AEAD operations.
Phalcon\Contracts\Encryption\Crypt\Crypt
Method Summary¶
public string decrypt(string $input,string $key = null) Decrypts a text public string decryptBase64(string $input,string $key = null) Decrypt a text that is coded as a base64 string public string encrypt(string $input,string $key = null) Encrypts a text public string encryptBase64(string $input,string $key = null) Encrypts a text returning the result as a base64 string public string getAuthData() Returns authentication data public string getAuthTag() Returns the authentication tag public int getAuthTagLength() Returns the authentication tag length public array getAvailableCiphers() Returns a list of available cyphers public string getCipher() Returns the current cipher public string getKey() Returns the encryption key public Crypt setAuthData( string $data ) Sets authentication data public Crypt setAuthTag( string $tag ) Sets the authentication tag public Crypt setAuthTagLength( int $length ) Sets the authentication tag length public Crypt setCipher( string $cipher ) Sets the cipher algorithm public Crypt setKey( string $key ) Sets the encryption key public Crypt setPadding( int $scheme ) Changes the padding scheme used. public Crypt useSigning( bool $useSigning ) Sets if the calculating message digest must be used. Methods¶
decrypt()¶
Decrypts a text
decryptBase64()¶
Decrypt a text that is coded as a base64 string
encrypt()¶
Encrypts a text
encryptBase64()¶
Encrypts a text returning the result as a base64 string
getAuthData()¶
Returns authentication data
getAuthTag()¶
Returns the authentication tag
getAuthTagLength()¶
Returns the authentication tag length
getAvailableCiphers()¶
Returns a list of available cyphers
getCipher()¶
Returns the current cipher
getKey()¶
Returns the encryption key
setAuthData()¶
Sets authentication data
setAuthTag()¶
Sets the authentication tag
setAuthTagLength()¶
Sets the authentication tag length
setCipher()¶
Sets the cipher algorithm
setKey()¶
Sets the encryption key
setPadding()¶
Changes the padding scheme used.
useSigning()¶
Sets if the calculating message digest must be used.
Contracts\Encryption\Crypt\Padding\Pad¶
Interface Source on GitHub
Canonical contract for Phalcon\Encryption\Crypt\Padding strategies.
The pad/unpad protocol operates on binary (8-bit) data. Implementations must measure and slice the input with byte-true functions (strlen, substr, or the mb_* family with the explicit "8bit" encoding); using encoding-sensitive functions such as mb_strlen() on the padded plaintext yields the wrong padding size whenever the bytes form valid multibyte sequences.
Phalcon\Contracts\Encryption\Crypt\Padding\Pad
Method Summary¶
Methods¶
pad()¶
unpad()¶
Contracts\Encryption\Security\CryptoUtils¶
Interface Source on GitHub
Phalcon\Contracts\Encryption\Security\CryptoUtils
Uses Phalcon\Encryption\Security\Random
Method Summary¶
public string computeHmac(string $data,string $key,string $algorithm,bool $raw = false) public Random getRandom() public int getRandomBytes() public string getSaltBytes( int $numberBytes = 0 ) public Security setRandomBytes( int $randomBytes ) Methods¶
computeHmac()¶
public function computeHmac(
string $data,
string $key,
string $algorithm,
bool $raw = false
): string;
getRandom()¶
getRandomBytes()¶
getSaltBytes()¶
setRandomBytes()¶
Contracts\Encryption\Security\CsrfProtection¶
Interface Source on GitHub
Phalcon\Contracts\Encryption\Security\CsrfProtection
Method Summary¶
public bool checkToken(string $tokenKey = null,mixed $tokenValue = null,bool $destroyIfValid = true) public Security destroyToken() public string|null getRequestToken() public string|null getSessionToken() public string|null getToken() public string|null getTokenKey() Methods¶
checkToken()¶
public function checkToken(
string $tokenKey = null,
mixed $tokenValue = null,
bool $destroyIfValid = true
): bool;
destroyToken()¶
getRequestToken()¶
getSessionToken()¶
getToken()¶
getTokenKey()¶
Contracts\Encryption\Security\JWT\Signer\Signer¶
Interface Source on GitHub
Canonical contract for JWT Signer classes
Phalcon\Contracts\Encryption\Security\JWT\Signer\Signer
Method Summary¶
public string getAlgHeader() Return the value that is used for the "alg" header public string getAlgorithm() Return the algorithm used public string sign(string $payload,string $passphrase) Sign a payload using the passphrase public bool verify(string $source,string $payload,string $passphrase) Verify a passed source with a payload and passphrase Methods¶
getAlgHeader()¶
Return the value that is used for the "alg" header
getAlgorithm()¶
Return the algorithm used
sign()¶
Sign a payload using the passphrase
verify()¶
Verify a passed source with a payload and passphrase
Contracts\Encryption\Security\PasswordSecurity¶
Interface Source on GitHub
Phalcon\Contracts\Encryption\Security\PasswordSecurity
Method Summary¶
public bool checkHash(string $password,string $passwordHash,int $maxPassLength = 0) public int getDefaultHash() public array getHashInformation( string $hash ) public int getWorkFactor() public string hash(string $password,array $options = []) public bool isLegacyHash( string $passwordHash ) public Security setDefaultHash( int $defaultHash ) public Security setWorkFactor( int $workFactor ) Methods¶
checkHash()¶
getDefaultHash()¶
getHashInformation()¶
getWorkFactor()¶
hash()¶
isLegacyHash()¶
setDefaultHash()¶
setWorkFactor()¶
Contracts\Encryption\Security\Security¶
Interface Source on GitHub
Phalcon\Contracts\Encryption\Security\CryptoUtilsPhalcon\Contracts\Encryption\Security\Security— extendsPhalcon\Contracts\Encryption\Security\CryptoUtils,Phalcon\Contracts\Encryption\Security\CsrfProtection,Phalcon\Contracts\Encryption\Security\PasswordSecurity
Contracts\Encryption\Security\Uuid\NodeProvider¶
Interface Source on GitHub
Phalcon\Contracts\Encryption\Security\Uuid\NodeProvider
Method Summary¶
Methods¶
getNode()¶
Contracts\Encryption\Security\Uuid\TimeBasedUuid¶
Interface Source on GitHub
Phalcon\Contracts\Encryption\Security\Uuid\TimeBasedUuid
Method Summary¶
Methods¶
getDateTime()¶
getNode()¶
Contracts\Encryption\Security\Uuid\Uuid¶
Interface Source on GitHub
Canonical marker contract for UUID version adapters.
Also carries the standard RFC 4122 namespace UUIDs as constants.
Phalcon\Contracts\Encryption\Security\Uuid\Uuid
Constants¶
string NAMESPACE_DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8" string NAMESPACE_OID = "6ba7b812-9dad-11d1-80b4-00c04fd430c8" string NAMESPACE_URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8" string NAMESPACE_X500 = "6ba7b814-9dad-11d1-80b4-00c04fd430c8" Contracts\Events\Event¶
Interface Source on GitHub
Canonical contract for Phalcon\Events\Event.
Phalcon\Contracts\Events\Event
Method Summary¶
public mixed getData() Gets event data public mixed getType() Gets event type public bool isCancelable() Check whether the event is cancelable public bool isStopped() Check whether the event is currently stopped public Event setData( mixed $data = null ) Sets event data public Event setType( string $type ) Sets event type public Event stop() Stops the event preventing propagation Methods¶
getData()¶
Gets event data
getType()¶
Gets event type
isCancelable()¶
Check whether the event is cancelable
isStopped()¶
Check whether the event is currently stopped
setData()¶
Sets event data
setType()¶
Sets event type
stop()¶
Stops the event preventing propagation
Contracts\Events\EventsAware¶
Interface Source on GitHub
Canonical contract for Phalcon\Events\EventsAwareInterface. Implemented by components that accept an events manager and dispatch through it.
Cross-references the legacy ManagerInterface (not the canonical Manager contract) to preserve LSP for the many AbstractEventsAware subclasses that already type-hint ManagerInterface. ManagerInterface extends Manager, so this remains type-compatible with any code that needs the canonical surface.
Phalcon\Contracts\Events\EventsAware
Uses Phalcon\Events\ManagerInterface
Method Summary¶
public ManagerInterface|null getEventsManager() Returns the internal events manager public void setEventsManager( ManagerInterface $eventsManager ) Sets the events manager Methods¶
getEventsManager()¶
Returns the internal events manager
setEventsManager()¶
Sets the events manager
Contracts\Events\Manager¶
Interface Source on GitHub
Canonical contract for Phalcon\Events\Manager.
Phalcon\Contracts\Events\Manager
Method Summary¶
public void addSubscriber( Subscriber $subscriber ) Registers an event subscriber. The subscriber's getSubscribedEvents() public bool arePrioritiesEnabled() Returns whether priority ordering is currently enabled. public void attach(string $eventType,mixed $handler,int $priority = self::DEFAULT_PRIORITY) Attach a listener to the events manager. public void clearSubscribers() Removes every registered subscriber and detaches each listener they public void collectResponses( bool $collect ) Toggle response collection on/off. public void detach(string $eventType,mixed $handler) Detach a listener from the events manager. public void detachAll( string $type = null ) Removes all listeners - globally or for a single event type. public void enablePriorities( bool $enablePriorities ) Toggle priority ordering on/off. public fire(string $eventType,object $source,mixed $data = null,bool $cancelable = true) Fires an event, notifying the active listeners. public array getListeners( string $type ) Returns all listeners attached to the given event type. public array getResponses() Returns the responses recorded during the last fire (when collecting). public array getSubscribers() Returns the list of registered subscriber instances. public bool hasListeners( string $type ) Check whether the given event type has any listeners. public bool isCollecting() Check whether the manager is currently collecting responses. public bool isValidHandler( mixed $handler ) Returns true when the given handler is an object or callable. public void removeSubscriber( Subscriber $subscriber ) Removes a previously registered subscriber. Detaches every listener the Constants¶
int DEFAULT_PRIORITY = 100 Methods¶
addSubscriber()¶
Registers an event subscriber. The subscriber's getSubscribedEvents() map is parsed and each entry is attached through the regular listener pipeline.
arePrioritiesEnabled()¶
Returns whether priority ordering is currently enabled.
attach()¶
public function attach(
string $eventType,
mixed $handler,
int $priority = self::DEFAULT_PRIORITY
): void;
Attach a listener to the events manager.
clearSubscribers()¶
Removes every registered subscriber and detaches each listener they contributed. Listeners attached via attach() are untouched.
collectResponses()¶
Toggle response collection on/off.
detach()¶
Detach a listener from the events manager.
detachAll()¶
Removes all listeners - globally or for a single event type.
enablePriorities()¶
Toggle priority ordering on/off.
fire()¶
public function fire(
string $eventType,
object $source,
mixed $data = null,
bool $cancelable = true
);
Fires an event, notifying the active listeners.
getListeners()¶
Returns all listeners attached to the given event type.
getResponses()¶
Returns the responses recorded during the last fire (when collecting).
getSubscribers()¶
Returns the list of registered subscriber instances.
hasListeners()¶
Check whether the given event type has any listeners.
isCollecting()¶
Check whether the manager is currently collecting responses.
isValidHandler()¶
Returns true when the given handler is an object or callable.
removeSubscriber()¶
Removes a previously registered subscriber. Detaches every listener the subscriber declared via getSubscribedEvents(). Idempotent.
Contracts\Events\Stoppable¶
Interface Source on GitHub
Phalcon's local mirror of PSR-14 StoppableEventInterface. Identical shape; not extended from the PSR interface because the Zephir extension cannot reference Composer-loaded interfaces at build time. A separate bridge package exposes a PSR-14 adapter.
Phalcon\Contracts\Events\Stoppable
Method Summary¶
Methods¶
isPropagationStopped()¶
Returns true when the event must stop propagating to subsequent listeners.
Contracts\Events\Subscriber¶
Interface Source on GitHub
Contract for event subscriber classes. A subscriber declares the events it wants to listen to via a static map; Events\Manager parses the map and attaches each entry as a regular listener.
Accepted value shapes per event key:
'event:name' => 'methodName' 'event:name' => ['methodName', priority] 'event:name' => [ ['methodName1'], ['methodName2', priority], ]
Keys can be either a Phalcon event string (e.g. "db:beforeQuery") or a fully qualified event class name.
Wildcard subscriptions: Phalcon's manager fires both the prefix queue and the full-name queue (e.g. "db" is fired before "db:beforeQuery"). To subscribe to every event of a component, use the prefix as the key:
'db' => 'onAnyDbEvent' // fires for db:beforeQuery, db:afterQuery, ...
Phalcon\Contracts\Events\Subscriber
Method Summary¶
Methods¶
getSubscribedEvents()¶
Returns a map of event name => listener config. Called once per Manager::addSubscriber() / removeSubscriber() call.
Contracts\Filter\Sanitizer¶
Interface Source on GitHub
The contract for sanitizers registered in Phalcon\Filter\Filter.
A sanitizer is an invokable object: it must expose a public __invoke() method that receives the value to sanitize as its first parameter and returns the sanitized value. Additional parameters, when a sanitizer needs them (e.g. regex, replace), must be declared after the value parameter; Phalcon\Filter\Filter::sanitize() forwards them in order.
__invoke() is intentionally not declared here: implementations type their value parameter differently (string for text-only sanitizers, untyped for coercing ones), and PHP parameter variance does not allow an implementation to narrow a parameter declared by an interface.
A sanitizer operates on a single value. Array handling (one level of recursion by default) is the responsibility of Phalcon\Filter\Filter::sanitize(), not of the sanitizer.
Phalcon\Contracts\Filter\Sanitizer
Contracts\Flash\Flash¶
Interface Source on GitHub
Canonical contract for Phalcon\Flash messengers.
Note: output() and clear() are part of the concrete Direct / Session API and are not declared on this contract; they are scheduled to be added in the next major version.
Phalcon\Contracts\Flash\Flash
Method Summary¶
public string|null error( string $message ) Shows a HTML error message public string|null message(string $type,string $message) Outputs a message public string|null notice( string $message ) Shows a HTML notice/information message public string|null success( string $message ) Shows a HTML success message public string|null warning( string $message ) Shows a HTML warning message Methods¶
error()¶
Shows a HTML error message
message()¶
Outputs a message
Note: the shipped implementations (Direct, Session) accept string|array for $message; this contract declares string and is scheduled to be widened to mixed in the next major version. Delivery semantics differ per implementation: Direct::message() renders and emits the message immediately, while Session::message() stores the raw message for output on a later request.
notice()¶
Shows a HTML notice/information message
success()¶
Shows a HTML success message
warning()¶
Shows a HTML warning message
Contracts\Forms\Schema¶
Interface Source on GitHub
Contract for objects that supply a normalized list of form element definitions. Implementations may source the definitions from a PHP array, a JSON document, a YAML file, or any other format.
Each returned definition must be an associative array containing at least: - 'type' (string) - element type key (e.g. 'text', 'select', 'checkgroup') - 'name' (string) - the HTML name attribute value
Optional keys per definition: - 'label' (string) - visible label text - 'default' (mixed) - pre-populated default value - 'attributes' (array) - additional HTML attributes - 'filters' (array|string) - filter names applied on bind() - 'validators' (array) - ValidatorInterface instances - 'options' (array) - choices for select / checkgroup / radiogroup
Phalcon\Contracts\Forms\Schema
Method Summary¶
Methods¶
load()¶
Returns an ordered list of normalized element definitions.
Contracts\Html\Helper\Input\SelectData¶
Interface Source on GitHub
Interface for SELECT option data providers.
Return format: [value => label] for flat options; [groupLabel => [value => label, ...]] for optgroups.
Phalcon\Contracts\Html\Helper\Input\SelectData
Method Summary¶
Methods¶
getAttributes()¶
Returns the per-option attribute map.
Format: [optionValue => [attrName => stringValue, ...]]. Implementations must return resolved string values; no escaping, ordering, or rendering is performed here.
getOptions()¶
Contracts\Logger\Adapter\Adapter¶
Interface Source on GitHub
Canonical contract for Phalcon\Logger adapters.
Phalcon\Contracts\Logger\Adapter\Adapter
Uses Phalcon\Logger\Formatter\FormatterInterface · Phalcon\Logger\Item
Method Summary¶
public Adapter add( Item $item ) Adds a message in the queue public Adapter begin() Starts a transaction public bool close() Closes the logger public Adapter commit() Commits the internal transaction public FormatterInterface getFormatter() Returns the internal formatter public bool inTransaction() Returns the whether the logger is currently in an active transaction or public void process( Item $item ) Processes the message in the adapter public Adapter rollback() Rollbacks the internal transaction public Adapter setFormatter( FormatterInterface $formatter ) Sets the message formatter Methods¶
add()¶
Adds a message in the queue
begin()¶
Starts a transaction
close()¶
Closes the logger
commit()¶
Commits the internal transaction
getFormatter()¶
Returns the internal formatter
inTransaction()¶
Returns the whether the logger is currently in an active transaction or not
process()¶
Processes the message in the adapter
rollback()¶
Rollbacks the internal transaction
setFormatter()¶
Sets the message formatter
Contracts\Logger\Formatter\Formatter¶
Interface Source on GitHub
Canonical contract for Phalcon\Logger formatters.
Phalcon\Contracts\Logger\Formatter\Formatter
Uses Phalcon\Logger\Item
Method Summary¶
Methods¶
format()¶
Applies a format to an item
Contracts\Logger\Logger¶
Interface Source on GitHub
Canonical contract for Phalcon\Logger\Logger.
Phalcon\Contracts\Logger\Logger
Uses Phalcon\Contracts\Logger\Adapter\Adapter
Method Summary¶
public void alert(string $message,array $context = []) Action must be taken immediately. public void critical(string $message,array $context = []) Critical conditions. public void debug(string $message,array $context = []) Detailed debug information. public void emergency(string $message,array $context = []) System is unusable. public void error(string $message,array $context = []) Runtime errors that do not require immediate action but should typically public Adapter getAdapter( string $name ) Returns an adapter from the stack public array getAdapters() Returns the adapter stack array public int getLogLevel() Returns the log level public string getName() Returns the name of the logger public void info(string $message,array $context = []) Interesting events. public void log(mixed $level,string $message,array $context = []) Logs with an arbitrary level. public void notice(string $message,array $context = []) Normal but significant events. public void trace(string $message,array $context = []) Extra-verbose diagnostic output. public void warning(string $message,array $context = []) Exceptional occurrences that are not errors. Methods¶
alert()¶
Action must be taken immediately.
Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
critical()¶
Critical conditions.
Example: Application component unavailable, unexpected exception.
debug()¶
Detailed debug information.
emergency()¶
System is unusable.
error()¶
Runtime errors that do not require immediate action but should typically be logged and monitored.
getAdapter()¶
Returns an adapter from the stack
getAdapters()¶
Returns the adapter stack array
getLogLevel()¶
Returns the log level
getName()¶
Returns the name of the logger
info()¶
Interesting events.
Example: User logs in, SQL logs.
log()¶
Logs with an arbitrary level.
An unknown level (a typo or an unmapped value) is not rejected; it maps to the CUSTOM level and is logged, rather than raising an exception.
notice()¶
Normal but significant events.
trace()¶
Extra-verbose diagnostic output.
warning()¶
Exceptional occurrences that are not errors.
Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
Contracts\Messages\Messages¶
Interface Source on GitHub
Canonical contract for Phalcon\Messages\Messages.
The collection stores Phalcon\Messages\MessageInterface objects and is iterated by integer position. An entry added under a string key through the ArrayAccess interface stays reachable by that offset but is not visited during iteration (foreach), which walks the integer sequence only.
ArrayAccessPhalcon\Contracts\Messages\Messages— extendsArrayAccess,Countable,Iterator
Uses ArrayAccess · Countable · Iterator · Phalcon\Messages\MessageInterface
Method Summary¶
public void appendMessage( MessageInterface $message ) Appends a message to the collection public appendMessages( mixed $messages ) Appends an array of messages to the collection public array filter( string $fieldName ) Filters the message collection by field name Methods¶
appendMessage()¶
Appends a message to the collection
appendMessages()¶
Appends an array of messages to the collection
filter()¶
Filters the message collection by field name
Contracts\Mvc\Dispatcher¶
Interface Source on GitHub
Canonical contract for Phalcon\Mvc\Dispatcher.
Phalcon\Contracts\Dispatcher\DispatcherPhalcon\Contracts\Mvc\Dispatcher
Uses Phalcon\Contracts\Dispatcher\Dispatcher · Phalcon\Mvc\ControllerInterface
Method Summary¶
public ControllerInterface|null getActiveController() Returns the active controller in the dispatcher public string getControllerName() Gets last dispatched controller name public ControllerInterface|null getLastController() Returns the latest dispatched controller public DispatcherContract setControllerName( string $controllerName ) Sets the controller name to be dispatched public DispatcherContract setControllerSuffix( string $controllerSuffix ) Sets the default controller suffix public DispatcherContract setDefaultController( string $controllerName ) Sets the default controller name Methods¶
getActiveController()¶
Returns the active controller in the dispatcher
getControllerName()¶
Gets last dispatched controller name
getLastController()¶
Returns the latest dispatched controller
setControllerName()¶
Sets the controller name to be dispatched
setControllerSuffix()¶
Sets the default controller suffix
setDefaultController()¶
Sets the default controller name
Contracts\Mvc\Model\Relation\CacheKeyProvider¶
Interface Source on GitHub
Interface for models that provide a custom unique key for the reusable records cache in the Model Manager. Implement this interface when the default object-identity based key (unique_key) does not produce stable cache hits across multiple object instances that represent the same database record.
Phalcon\Contracts\Mvc\Model\Relation\CacheKeyProvider
Method Summary¶
Methods¶
getUniqueKey()¶
Returns a string that uniquely identifies this model instance for use as the key in the reusable records cache.
Contracts\Paginator\Adapter¶
Interface Source on GitHub
Interface for Phalcon\Paginator adapters
Phalcon\Contracts\Paginator\Adapter
Method Summary¶
public int getLimit() Get current rows limit public Repository paginate() Returns a slice of the resultset to show in the pagination public Adapter setCurrentPage( int $page ) Set the current page number public Adapter setLimit( int $limit ) Set current rows limit Methods¶
getLimit()¶
Get current rows limit
paginate()¶
Returns a slice of the resultset to show in the pagination
setCurrentPage()¶
Set the current page number
setLimit()¶
Set current rows limit
Contracts\Paginator\Repository¶
Interface Source on GitHub
Interface for the repository of current state Phalcon\Paginator\AdapterInterface::paginate()
Two adapter dialects fill this repository:
- Offset adapters (Model, NativeArray, QueryBuilder) populate every property as a sequential page number / item count.
- Cursor adapters (QueryBuilderCursor) reuse the same properties with a different meaning:
getCurrent()/getNext()carry keyset cursor values rather than page numbers, andgetTotalItems(),getLast()andgetPrevious()are not computed (they return 0).
Phalcon\Contracts\Paginator\Repository
Method Summary¶
public array getAliases() Gets the aliases for properties repository public int getCurrent() Gets number of the current page public int getFirst() Gets number of the first page public mixed getItems() Gets the items on the current page public int getLast() Gets number of the last page public int getLimit() Gets current rows limit public int getNext() Gets number of the next page public int getPrevious() Gets number of the previous page public int getTotalItems() Gets the total number of items public Repository setAliases( array $aliases ) Sets the aliases for properties repository public Repository setProperties( array $properties ) Sets values for properties of the repository Constants¶
string PROPERTY_CURRENT_PAGE = "current" string PROPERTY_FIRST_PAGE = "first" string PROPERTY_ITEMS = "items" string PROPERTY_LAST_PAGE = "last" string PROPERTY_LIMIT = "limit" string PROPERTY_NEXT_PAGE = "next" string PROPERTY_PREVIOUS_PAGE = "previous" string PROPERTY_TOTAL_ITEMS = "total_items" Methods¶
getAliases()¶
Gets the aliases for properties repository
getCurrent()¶
Gets number of the current page
Cursor adapters store the cursor value used for the current page here (0 on the first page), not a sequential page number.
getFirst()¶
Gets number of the first page
getItems()¶
Gets the items on the current page
getLast()¶
Gets number of the last page
Cursor adapters do not compute this and return 0.
getLimit()¶
Gets current rows limit
getNext()¶
Gets number of the next page
Cursor adapters store the next cursor value here rather than a page number; 0 means there is no next page.
getPrevious()¶
Gets number of the previous page
Cursor adapters do not compute this and return 0.
getTotalItems()¶
Gets the total number of items
Cursor adapters do not compute this and return 0.
setAliases()¶
Sets the aliases for properties repository
setProperties()¶
Sets values for properties of the repository
Contracts\Support\Collection¶
Interface Source on GitHub
Canonical contract for Phalcon\Support\Collection.
@extends ArrayAccess
ArrayAccessPhalcon\Contracts\Support\Collection— extendsArrayAccess,IteratorAggregate
Uses ArrayAccess · IteratorAggregate
Method Summary¶
public mixed __get( string $element ) public bool __isset( string $element ) public void __set(string $element,mixed $value) public void __unset( string $element ) public void clear() Clears the internal collection. public array column( string $propertyOrMethod ) Returns the values from a single property/method extracted from every public static each( callable $callback ) Invokes the callback for every item in the collection. public static filter( callable $callback ) Returns a new collection of items for which the callback returns true. public mixed first() Returns the first value in the collection or null when empty. public mixed get(string $element,mixed $defaultValue = null,string $cast = null) Returns an element from the collection. public array getKeys( bool $insensitive = true ) Returns the keys (insensitive or not) of the collection. public string|null getType() Returns the configured runtime type guard, or null when not set. public array getValues() Returns the values of the internal array. public bool has( string $element ) Checks whether an element exists in the collection. public void init( array $data = [] ) Initializes the internal array. public bool isEmpty() Returns true when the collection has no entries. public array keys( bool $insensitive = true ) Returns the keys (insensitive or not) of the collection. public mixed last() Returns the last value in the collection or null when empty. public static map( callable $callback ) Returns a new collection with the callback applied to every value. public mixed reduce(callable $callback,mixed $initial = null) Reduces the collection to a single value using the callback. public void remove( string $element ) Removes the element from the collection. public void replace( array $data ) Replaces the collection data with a new array, clearing first. public void set(string $element,mixed $value) Stores an element in the collection. public static sort(callable $callback = null,int $order = 4) Returns a new collection sorted by value, preserving keys. public array toArray() Returns the collection as an array. public string toJson( int $options = 4194383 ) Returns the collection serialized as a JSON string. public array values() Returns the values of the internal array. public static where(string $propertyOrMethod,mixed $value) Returns a new collection containing only the items whose Methods¶
__get()¶
__isset()¶
__set()¶
__unset()¶
clear()¶
Clears the internal collection.
column()¶
Returns the values from a single property/method extracted from every item in the collection, keyed by the original collection key.
each()¶
Invokes the callback for every item in the collection.
filter()¶
Returns a new collection of items for which the callback returns true.
first()¶
Returns the first value in the collection or null when empty.
get()¶
Returns an element from the collection.
getKeys()¶
Returns the keys (insensitive or not) of the collection.
getType()¶
Returns the configured runtime type guard, or null when not set.
getValues()¶
Returns the values of the internal array.
has()¶
Checks whether an element exists in the collection.
init()¶
Initializes the internal array.
isEmpty()¶
Returns true when the collection has no entries.
keys()¶
Returns the keys (insensitive or not) of the collection.
last()¶
Returns the last value in the collection or null when empty.
map()¶
Returns a new collection with the callback applied to every value.
reduce()¶
Reduces the collection to a single value using the callback.
remove()¶
Removes the element from the collection.
replace()¶
Replaces the collection data with a new array, clearing first.
set()¶
Stores an element in the collection.
sort()¶
Returns a new collection sorted by value, preserving keys.
toArray()¶
Returns the collection as an array.
toJson()¶
Returns the collection serialized as a JSON string.
values()¶
Returns the values of the internal array.
where()¶
Returns a new collection containing only the items whose propertyOrMethod strictly equals $value.