Phalcon contracts
NOTE
All classes are prefixed with Phalcon
Contracts\Auth\Access\Access¶
Interface Source on GitHub
Phalcon\Contracts\Auth\Access\Access
Method Summary¶
public bool allowedIf() public array getExceptActions() public array getOnlyActions() public bool isAllowed( string $actionName ) public array|null redirectTo() public void setExceptActions( array $exceptActions = [] ) public void setOnlyActions( array $onlyActions = [] ) Methods¶
allowedIf()¶
getExceptActions()¶
getOnlyActions()¶
isAllowed()¶
redirectTo()¶
setExceptActions()¶
setOnlyActions()¶
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
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been influenced by sinbadxiii/cphalcon-auth @link https://github.com/sinbadxiii/cphalcon-auth
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
Method Summary¶
public bool check() Whether the current request is authenticated. public static fromOptions(Adapter $adapter,Collection $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()¶
public static function fromOptions(
Adapter $adapter,
Collection $container,
array $options
): static;
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.
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 ) 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() 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()¶
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()¶
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\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
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
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
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
Phalcon\Contracts\Container\Resolver\ReflectionParameterResolver
Uses Phalcon\Contracts\Container\Ioc\IocContainer · ReflectionParameter
Method Summary¶
Methods¶
resolveParameter()¶
Contracts\Container\Resolver\Resolvable¶
Interface Source on GitHub
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
Phalcon\Contracts\Container\Resolver\Resolvable
Uses Phalcon\Contracts\Container\Ioc\IocContainer
Method Summary¶
Methods¶
resolve()¶
Contracts\Container\Resolver\ResolverService¶
Interface Source on GitHub
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
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
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
ThrowablePhalcon\Contracts\Container\Resolver\ResolverThrowable
Uses Throwable
Contracts\Container\Service\Collection¶
Interface Source on GitHub
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
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
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
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
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
Phalcon\Contracts\Container\Service\Provider
Method Summary¶
Methods¶
provide()¶
Contracts\Container\Service\Throwable¶
Interface Source on GitHub
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
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
@deprecated Will re removed in the next version
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
describeReferences()¶
Generates SQL to query foreign keys on a table
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\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\Encryption\Security\CryptoUtils¶
Interface Source on GitHub
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
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
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
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\PasswordSecurity¶
Interface Source on GitHub
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
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
This file is part of the Phalcon Framework.
(c) Phalcon Team team@phalcon.io
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
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\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\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\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
Uses Phalcon\Paginator\Adapter\AdapterInterface
Method Summary¶
public int getLimit() Get current rows limit public Repository paginate() Returns a slice of the resultset to show in the pagination public AdapterInterface setCurrentPage( int $page ) Set the current page number public AdapterInterface 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()
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
getFirst()¶
Gets number of the first page
getItems()¶
Gets the items on the current page
getLast()¶
Gets number of the last page
getLimit()¶
Gets current rows limit
getNext()¶
Gets number of the next page
getPrevious()¶
Gets number of the previous page
getTotalItems()¶
Gets the total number of items
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.
@deprecated Use {@see self::keys()} instead. Will be removed in a future major release.
getType()¶
Returns the configured runtime type guard, or null when not set.
getValues()¶
Returns the values of the internal array.
@deprecated Use {@see self::values()} instead. Will be removed in a future major release.
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.