PhalconMigrations
Class PhalconMigrations
This class represents a PhalconMigrations object. It extends the PhalconMigrationsAbstract class and implements the PhalconMigrationsInterface.
- Full name:
\Zemit\Models\PhalconMigrations
- Parent class:
\Zemit\Models\Abstracts\PhalconMigrationsAbstract
- This class implements:
\Zemit\Models\Interfaces\PhalconMigrationsInterface
Methods
initialize
public initialize(): void
validation
public validation(): bool
Inherited methods
getId
Returns the value of field id Column: id Attributes: First | NotNull | Numeric | Unsigned | AutoIncrement
public getId(): mixed
setId
Sets the value of field id Column: id Attributes: First | NotNull | Numeric | Unsigned | AutoIncrement
public setId(mixed $id): void
Parameters:
Parameter | Type | Description |
---|---|---|
$id | mixed |
getVersion
Returns the value of field version Column: version Attributes: Primary | NotNull | Size(255) | Type(2)
public getVersion(): mixed
setVersion
Sets the value of field version Column: version Attributes: Primary | NotNull | Size(255) | Type(2)
public setVersion(mixed $version): void
Parameters:
Parameter | Type | Description |
---|---|---|
$version | mixed |
getStartTime
Returns the value of field startTime Column: start_time Attributes: NotNull | Type(17)
public getStartTime(): mixed
setStartTime
Sets the value of field startTime Column: start_time Attributes: NotNull | Type(17)
public setStartTime(mixed $startTime): void
Parameters:
Parameter | Type | Description |
---|---|---|
$startTime | mixed |
getEndTime
Returns the value of field endTime Column: end_time Attributes: NotNull | Type(17)
public getEndTime(): mixed
setEndTime
Sets the value of field endTime Column: end_time Attributes: NotNull | Type(17)
public setEndTime(mixed $endTime): void
Parameters:
Parameter | Type | Description |
---|---|---|
$endTime | mixed |
addDefaultRelationships
Adds the default relationships to the model.
public addDefaultRelationships(): void
addDefaultValidations
Adds the default validations to the model.
public addDefaultValidations(\Zemit\Filter\Validation|null $validator = null): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | **\Zemit\Filter\Validation | null** |
columnMap
Returns an array that maps the column names of the database table to the corresponding property names of the model.
public columnMap(): array
initialize
public initialize(): void
setup
Enables/disables options in the ORM - We do this here in order to keep behaviour consistencies between different environments
caseInsensitiveColumnMap - false - Case insensitive column map castLastInsertIdToInt - false - Casts the lastInsertId to an integer castOnHydrate - false - Automatic cast to original types on hydration columnRenaming - true - Column renaming disableAssignSetters - false - Disable setters enableImplicitJoins - true - Enable implicit joins events - true - Callbacks, hooks and event notifications from all the models exceptionOnFailedMetaDataSave - false - Throw an exception when there is a failed meta-data save exceptionOnFailedSave - false - Throw an exception when there is a failed save() ignoreUnknownColumns - false - Ignore unknown columns on the model lateStateBinding - false - Late state binding of the Phalcon\Mvc\Model::cloneResultMap() method notNullValidations - true - Automatically validate the not null columns present phqlLiterals - true - Literals in the PHQL parser prefetchRecords - 0 - The number of records to prefetch when getting data from the ORM updateSnapshotOnSave - true - Update snapshots on save() virtualForeignKeys - true - Virtual foreign keys
public static setup(array|null $options = null): void
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$options | **array | null** |
See Also:
- https://docs.phalcon.io/latest/en/db-models#model-features -
getAttribute
Returns the value of the specified attribute.
public getAttribute(string $attribute): mixed|null
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute | string | The name of the attribute. |
Return Value:
The value of the specified attribute if it exists, otherwise null.
setAttribute
Sets the value of the specified attribute.
public setAttribute(string $attribute, mixed $value): void
Parameters:
Parameter | Type | Description |
---|---|---|
$attribute | string | The name of the attribute. |
$value | mixed | The value to be set for the attribute. |
initializeBlameable
Initialize Blameable
public initializeBlameable(array|null $options = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$options | **array | null** |
setBlameableBehavior
Set Blameable Behavior.
public setBlameableBehavior(\Zemit\Mvc\Model\Behavior\Blameable $blameableBehavior): void
Parameters:
Parameter | Type | Description |
---|---|---|
$blameableBehavior | \Zemit\Mvc\Model\Behavior\Blameable | The BlameableBehavior instance to set. |
getBlameableBehavior
Retrieves the BlameableBehavior instance associated with the current object.
public getBlameableBehavior(): \Zemit\Mvc\Model\Behavior\Blameable
Return Value:
The BlameableBehavior instance.
addUserRelationship
Adds a relationship between the current object and a user entity.
public addUserRelationship(string $field = 'userId', string $alias = 'UserEntity', array $params = [], string $ref = 'id', string $type = 'belongsTo', string|null $class = null): \Phalcon\Mvc\Model\Relation|null
Parameters:
Parameter | Type | Description |
---|---|---|
$field | string | The field name to create the relationship on. Default is 'userId'. |
$alias | string | The alias name for the user entity. Default is 'UserEntity'. |
$params | array | Additional parameters for the relationship. Default is an empty array. |
$ref | string | The reference field in the user entity. Default is 'id'. |
$type | string | The type of relationship to create. Default is 'belongsTo'. |
$class | **string | null** |
Return Value:
The created relationship object, or null if the specified field does not exist in the current object.
initializeCache
Initializing Cache
public initializeCache(): void
addFlushCacheBehavior
Adding Cache Behavior
public addFlushCacheBehavior(?array $flushModelsCacheBlackList = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$flushModelsCacheBlackList | ?array |
isInstanceOf
Check whether the current instance is any of the classes
public isInstanceOf(array $classes = [], ?\Phalcon\Mvc\ModelInterface $that = null): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$classes | array | |
$that | ?\Phalcon\Mvc\ModelInterface |
find
public static find(mixed $parameters = null): \Phalcon\Mvc\Model\ResultsetInterface
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$parameters | mixed |
findFirst
public static findFirst(mixed $parameters = null): mixed
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$parameters | mixed |
findWith
<?php
public static findWith(array $arguments): array
$limit = 100; $offset = max(0, $this->request->getQuery('page', 'int') - 1) * $limit;
$manufacturers = Manufacturer::with('Robots.Parts', [ 'limit' => [$limit, $offset] ]);
foreach ($manufacturers as $manufacturer) { foreach ($manufacturer->robots as $robot) { foreach ($robot->parts as $part) { ... } } }
public jsonEncode(mixed $value, int $flags = JSON_UNESCAPED_SLASHES, int $depth = 512): string|false
Parameters:
Parameter | Type | Description |
---|---|---|
$value | mixed | The value to be encoded. |
$flags | int | [Optional] Bitmask of JSON encode options. |
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$arguments | array |
findFirstWith
Same as EagerLoadingTrait::findWith() for a single record
public static findFirstWith(array $arguments): ?\Phalcon\Mvc\ModelInterface
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$arguments | array |
with
public static with(array $arguments): mixed
-
This method is static.
-
Warning: this method is deprecated. This means that this method will likely be removed in a future version.
Parameters:
Parameter | Type | Description |
---|---|---|
$arguments | array |
See Also:
- self::findWith() -
firstWith
public static firstWith(array $arguments): mixed
-
This method is static.
-
Warning: this method is deprecated. This means that this method will likely be removed in a future version.
Parameters:
Parameter | Type | Description |
---|---|---|
$arguments | array |
See Also:
- self::findFirstWith() -
__callStatic
Call magic method to make the with works in an implicit way
public static __callStatic(string $method, array $arguments = []): mixed
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$method | string | |
$arguments | array |
findFirstWithBy
Call native Phalcon FindFirstBy function then eager load relationships from the model
private static findFirstWithBy(string $forwardMethod, array $arguments): ?\Phalcon\Mvc\ModelInterface
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$forwardMethod | string | |
$arguments | array |
findWithBy
Call native Phalcon findBy function then eager load relationships from the resultset
private static findWithBy(string $forwardMethod, array $arguments): ?array
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$forwardMethod | string | |
$arguments | array |
load
public load(array $arguments): ?\Phalcon\Mvc\ModelInterface
$manufacturer = Manufacturer::findFirstById(51);
$manufacturer->load('Robots.Parts');
foreach ($manufacturer->robots as $robot) { foreach ($robot->parts as $part) { ... } }
_
Translate a given key using the translation service
public _(string $translateKey, array $placeholders = []): string
Parameters:
Parameter | Type | Description |
---|---|---|
$translateKey | string | The key to be translated |
$placeholders | array | The placeholders to be replaced in the translation |
Return Value:
The translated string
__call
Magic method to dynamically call localed named methods using the current locale - Allow to call $this->
Parameters:
Parameter | Type | Description |
---|---|---|
$arguments | array |
getParametersFromArguments
Get the query parameters from a list of arguments
public static getParametersFromArguments(array& $arguments): mixed
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$arguments | array |
fireEventCancel
public fireEventCancel(string $eventName): bool
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$eventName | string |
count
public static count(mixed $parameters = null): mixed
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$parameters | mixed |
sum
public static sum(mixed $parameters = null): mixed
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$parameters | mixed |
average
public static average(mixed $parameters = null): mixed
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$parameters | mixed |
fireEventCancelCall
public static fireEventCancelCall(string $method, array $arguments = []): mixed
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$method | string | |
$arguments | array |
expose
public expose(?array $columns = null, ?bool $expose = null, ?bool $protected = null): array
Parameters:
Parameter | Type | Description |
---|---|---|
$columns | ?array | |
$expose | ?bool | |
$protected | ?bool |
findInById
public static findInById(array $idList = []): mixed
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$idList | array |
hash
Hash a string
public hash(string $string, string|null $salt = null, string|null $workFactor = null): string
Parameters:
Parameter | Type | Description |
---|---|---|
$string | string | The string to be hashed |
$salt | **string | null** |
$workFactor | **string | null** |
Return Value:
The salted hash value of the input string
checkHash
Checks whether a given hash is valid for a given string.
public checkHash(string|null $hash = null, string|null $string = null, int $maxPassLength): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$hash | **string | null** |
$string | **string | null** |
$maxPassLength | int | The maximum length of the password. |
Return Value:
Returns true if the hash is valid for the string, false otherwise.
getIdentityService
Get the current identity service from the DI
public getIdentityService(): \Zemit\Identity
isLoggedIn
Check if a user is logged in
public isLoggedIn(bool $as = false): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$as | bool | Optional parameter to specify the identity state to check |
Return Value:
Returns true if the user is logged in, false otherwise
isLoggedInAs
Check if the user is logged in as another user.
public isLoggedInAs(): bool
Return Value:
True if the user is logged in as another user, false otherwise.
getCurrentUser
Get the current user.
public getCurrentUser(bool $as = false): \Zemit\Models\Interfaces\UserInterface|null
Parameters:
Parameter | Type | Description |
---|---|---|
$as | bool | If true, return the UserInterface object. Default is false. |
Return Value:
Returns the current user as a UserInterface object if $as is true. Returns null if there is no current user or the user is not found.
getCurrentUserAs
Get the current delegated UserInterface object
public getCurrentUserAs(): \Zemit\Models\Interfaces\UserInterface|null
Return Value:
The current user as UserInterface if available, null otherwise
getCurrentUserId
Retrieves the ID of the currently logged-in user.
public getCurrentUserId(bool $as = false): int|null
Parameters:
Parameter | Type | Description |
---|---|---|
$as | bool | Optional flag indicating whether to retrieve the user as well. If set to true, the complete user object will be returned. If set to false (default), only the user ID will be returned. |
Return Value:
If $as is true, it returns the ID of the currently logged-in user as an integer. If $as is false, it returns null if there is no logged-in user or the ID of the currently logged-in user as an integer.
getCurrentUserIdCallback
Retrieves a callback function that returns the ID of the currently logged-in user.
public getCurrentUserIdCallback(bool $as = false): \Closure
Parameters:
Parameter | Type | Description |
---|---|---|
$as | bool | Optional flag indicating whether to retrieve the user as well. If set to true, the complete user object will be returned. If set to false (default), only the user ID will be returned. |
Return Value:
A callback function that, when invoked, returns the ID of the currently logged-in user. The returned ID will be null if there is no logged-in user or an integer if the user is logged in.
jsonEncode
Encodes a value to JSON.
public jsonEncode(mixed $value, int $flags = JSON_UNESCAPED_SLASHES, int $depth = 512): string|false
Parameters:
Parameter | Type | Description |
---|---|---|
$value | mixed | The value to be encoded. |
$flags | int | [Optional] Bitmask of JSON encode options. Defaults to JSON_UNESCAPED_SLASHES. |
$depth | int | [Optional] The maximum depth of recursion when encoding nested objects. Defaults to 512. |
Return Value:
The JSON encoded string on success, or false
on failure.
jsonDecode
Decodes a JSON string.
public jsonDecode(string $json, bool|null $associative = null, int $depth = 512, int $flags): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$json | string | The JSON string to be decoded. |
$associative | **bool | null** |
$depth | int | [Optional] The maximum depth of recursion when decoding nested objects. Defaults to 512. |
$flags | int | [Optional] Bitmask of JSON decode options. Defaults to 0. |
Return Value:
The decoded value on success, or the original JSON string on failure.
prepareLifeCycleQuery
Return the query for data retention
public static prepareLifeCycleQuery(\Phalcon\Mvc\Model\Query\BuilderInterface $builder, ?array $parameters = null): void
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$builder | \Phalcon\Mvc\Model\Query\BuilderInterface | |
$parameters | ?array |
getLifeCyclePolicy
public static getLifeCyclePolicy(): array
- This method is static.
getLifeCyclePolicyQuery
public static getLifeCyclePolicyQuery(): ?array
- This method is static.
getLifeCycleQuery
Return the Query for data retention
public static getLifeCycleQuery(?array $parameters = null, ?\Phalcon\Mvc\Model\Query\BuilderInterface $builder = null): \Phalcon\Mvc\Model\QueryInterface
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$parameters | ?array | |
$builder | ?\Phalcon\Mvc\Model\Query\BuilderInterface |
getBuilder
Return a Query Builder based on parameters
public static getBuilder(?array $parameters = null): \Phalcon\Mvc\Model\Query\BuilderInterface
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$parameters | ?array |
findLifeCycle
Find records to hard delete for data retention purpose
public static findLifeCycle(?array $parameters = null): mixed
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$parameters | ?array |
_
Translate a given key using the translation service
public _(string $translateKey, array $placeholders = []): string
Parameters:
Parameter | Type | Description |
---|---|---|
$translateKey | string | The key to be translated |
$placeholders | array | The placeholders to be replaced in the translation |
Return Value:
The translated string
__call
Magic method to dynamically call localed named methods using the current locale - Allow to call $this->methodName{Fr|En|Sp|...}() from missing methodName method
public __call(string $method, array $arguments): mixed|null
Parameters:
Parameter | Type | Description |
---|---|---|
$method | string | method name |
$arguments | array | method arguments |
Throws:
__set
Magic setter to set localed named field automatically using the current locale - Allow to set $this->name{Fr|En|Sp|...} for missing name property
public __set(string $property, mixed $value): void
Parameters:
Parameter | Type | Description |
---|---|---|
$property | string | property name |
$value | mixed | value to be set for the property |
__get
Magic getter to get localed named field automatically using the current locale - Allow to get $this->name{Fr|En|Sp|...} from missing name property
public __get(string $property): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$property | string | property name |
getColumnMap
Get the column mapping of the model
public getColumnMap(): array|null
Return Value:
The column mapping of the model, or null if no mapping is defined
getPrimaryKeys
Retrieves the primary keys attributes of the model.
public getPrimaryKeys(): array
Return Value:
Array containing the primary keys of the model.
getPrimaryKeysValues
Retrieves the values of the primary keys attributes of the entity.
public getPrimaryKeysValues(): array
Return Value:
Array containing the values of the primary keys attributes of the entity.
initializeOptions
Initialize the Options Manager for the current instance
public initializeOptions(): void
getOptionsManager
Get the Options Manager for the current instance
public getOptionsManager(): \Zemit\Support\Options\ManagerInterface
Return Value:
The Options Manager for the current instance
setOptionsManager
Sets the options manager.
public setOptionsManager(\Zemit\Support\Options\ManagerInterface $optionsManager): void
Parameters:
Parameter | Type | Description |
---|---|---|
$optionsManager | \Zemit\Support\Options\ManagerInterface | The options manager to be set. |
initializePosition
Initializes the position behavior for the current object.
public initializePosition(array|null $options = null): void
Sets the position options and sets the position behavior accordingly.
Parameters:
Parameter | Type | Description |
---|---|---|
$options | **array | null** |
Throws:
setPositionBehavior
Sets the position behavior for the current object.
public setPositionBehavior(\Zemit\Mvc\Model\Behavior\Position $positionBehavior): void
Parameters:
Parameter | Type | Description |
---|---|---|
$positionBehavior | \Zemit\Mvc\Model\Behavior\Position | The position behavior to be set. |
getPositionBehavior
Retrieves the position behavior attached to the current object.
public getPositionBehavior(): \Zemit\Mvc\Model\Behavior\Position
Return Value:
The position behavior object.
Throws:
if the position behavior is not found.ilds the message context.
public rebuildMessageContext(\Phalcon\Messages\Message $message, string|null $context = null): string
public rebuildMessageIndex(\Phalcon\Messages\Message $message, int|null $index = null): string
public relatedToArray(array|null $columns = null, bool $useGetter = true): array
public getRelated(string $alias, $arguments = null): false|int|\Phalcon\Mvc\Model\Resultset\Simple
public toArray(mixed $columns = null, mixed $useGetter = true): array
public setConnectionService(string $connectionService): void
public setReadConnectionService(string $connectionService): void
public setWriteConnectionService(string $connectionService): void
public getWriteConnectionService(): string
public getReadConnectionService(): string
public static getReplicationLag(): ?int
public static setReplicationLag(?int $replicationLag = null): void
public static getReplicationReadyAt(): ?int
public static setReplicationReadyAt(?int $replicationReadyAt = null): void
public initializeReplication(?array $options = null): void
public selectReadConnection(): \Phalcon\Db\Adapter\AdapterInterface
public addReadWriteConnectionBehavior(): void
public isReplicationReady(): bool
public initializeSecurity(array|null $options = null): void
reorder
Reorders the current object's position in the list.
public reorder(int|null $position = null, string|null $positionField = null): bool
- Update position+1 done using afterSave event
Parameters:
Parameter | Type | Description |
---|---|---|
$position | **int | null** |
$positionField | **string | null** |
Return Value:
Returns true if the reorder operation was successful, false otherwise.
Throws:
appendMessage
public appendMessage(\Phalcon\Messages\MessageInterface $message): \Phalcon\Mvc\ModelInterface
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$message | \Phalcon\Messages\MessageInterface |
setKeepMissingRelated
Set the missing related configuration list
public setKeepMissingRelated(array $keepMissingRelated): void
Parameters:
Parameter | Type | Description |
---|---|---|
$keepMissingRelated | array |
getKeepMissingRelated
Return the missing related configuration list
public getKeepMissingRelated(): array
getKeepMissingRelatedAlias
Return the keepMissing configuration for a specific relationship alias
public getKeepMissingRelatedAlias(string $alias): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$alias | string |
setKeepMissingRelatedAlias
Set the keepMissing configuration for a specific relationship alias
public setKeepMissingRelatedAlias(string $alias, bool $keepMissing): void
Parameters:
Parameter | Type | Description |
---|---|---|
$alias | string | |
$keepMissing | bool |
getRelationshipContext
Get the current relationship context
public getRelationshipContext(): string
setRelationshipContext
Set the current relationship context
public setRelationshipContext(string $context): void
Parameters:
Parameter | Type | Description |
---|---|---|
$context | string |
getDirtyRelated
Return the dirtyRelated entities
public getDirtyRelated(): array
setDirtyRelated
Set the dirtyRelated entities
public setDirtyRelated(array $dirtyRelated): void
Parameters:
Parameter | Type | Description |
---|---|---|
$dirtyRelated | array |
getDirtyRelatedAlias
Return the dirtyRelated entities
public getDirtyRelatedAlias(string $alias): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$alias | string |
setDirtyRelatedAlias
Return the dirtyRelated entities
public setDirtyRelatedAlias(string $alias, mixed $value): void
Parameters:
Parameter | Type | Description |
---|---|---|
$alias | string | |
$value | mixed |
hasDirtyRelated
Check whether the current entity has dirty related or not
public hasDirtyRelated(): bool
hasDirtyRelatedAlias
Check whether the current entity has dirty related or not
public hasDirtyRelatedAlias(string $alias): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$alias | string |
assign
{@inheritDoc}
public assign(array $data, mixed $whiteList = null, mixed $dataColumnMap = null): \Phalcon\Mvc\ModelInterface
Parameters:
Parameter | Type | Description |
---|---|---|
$data | array | |
$whiteList | mixed | |
$dataColumnMap | mixed |
Throws:
assignRelated
Assign related
public assignRelated(array $data, array|null $whiteList = null, array|null $dataColumnMap = null): \Phalcon\Mvc\ModelInterface
Single [alias => new Alias()] // create new alias
Many [alias => [new Alias()]] // create new alias [alias => [1, 2, 3, 4]] // append / merge 1, 2, 3, 4 [alias => [false, 1, 2, 4]]; // delete 3
Parameters:
Parameter | Type | Description |
---|---|---|
$data | array | |
$whiteList | **array | null** |
$dataColumnMap | **array | null** |
Throws:
preSaveRelatedRecords
Saves related records that must be stored prior to save the master record Refactored based on the native cphalcon version, so we can support : - combined keys on relationship definition - relationship context within the model messages based on the alias definition
protected preSaveRelatedRecords(\Phalcon\Db\Adapter\AdapterInterface $connection, mixed $related, \Phalcon\Support\Collection\CollectionInterface $visited): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$connection | \Phalcon\Db\Adapter\AdapterInterface | |
$related | mixed | |
$visited | \Phalcon\Support\Collection\CollectionInterface |
Throws:
postSaveRelatedRecords
NOTE: we need this, this behaviour only happens: - in many to many nodes Fix uniqueness on combined keys in node entities, and possibly more.
protected postSaveRelatedRecords(\Phalcon\Db\Adapter\AdapterInterface $connection, mixed $related, \Phalcon\Support\Collection\CollectionInterface $visited): bool
..
Parameters:
Parameter | Type | Description |
---|---|---|
$connection | \Phalcon\Db\Adapter\AdapterInterface | |
$related | mixed | |
$visited | \Phalcon\Support\Collection\CollectionInterface |
Throws:
See Also:
- https://forum.phalconphp.com/discussion/2190/many-to-many-expected-behaviour - * http://stackoverflow.com/questions/23374858/update-a-records-n-n-relationships - * https://github.com/phalcon/cphalcon/issues/2871 -
postSaveRelatedRecordsAfter
public postSaveRelatedRecordsAfter(\Phalcon\Mvc\Model\RelationInterface $relation, mixed $relatedRecords, \Phalcon\Support\Collection\CollectionInterface $visited): ?bool
Parameters:
Parameter | Type | Description |
---|---|---|
$relation | \Phalcon\Mvc\Model\RelationInterface | |
$relatedRecords | mixed | |
$visited | \Phalcon\Support\Collection\CollectionInterface |
postSaveRelatedThroughAfter
public postSaveRelatedThroughAfter(\Phalcon\Mvc\Model\RelationInterface $relation, mixed $relatedRecords, \Phalcon\Support\Collection\CollectionInterface $visited): ?bool
Parameters:
Parameter | Type | Description |
---|---|---|
$relation | \Phalcon\Mvc\Model\RelationInterface | |
$relatedRecords | mixed | |
$visited | \Phalcon\Support\Collection\CollectionInterface |
getEntityFromData
Get an entity from data
public getEntityFromData(array $data, array $configuration = []): \Phalcon\Mvc\ModelInterface
Parameters:
Parameter | Type | Description |
---|---|---|
$data | array | |
$configuration | array |
appendMessages
public appendMessages(array $messages = [], ?string $context = null, ?int $index = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$messages | array | |
$context | ?string | |
$index | ?int |
appendMessagesFromRecord
Appends messages from a record to the current messages container.
public appendMessagesFromRecord(\Phalcon\Mvc\ModelInterface|null $record = null, string|null $context = null, int|null $index = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$record | **\Phalcon\Mvc\ModelInterface | null** |
$context | **string | null** |
$index | **int | null** |
appendMessagesFromResultset
Append messages from a resultset to the current message container.
public appendMessagesFromResultset(\Phalcon\Mvc\Model\ResultsetInterface|null $resultset = null, string|null $context = null, int|null $index = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$resultset | **\Phalcon\Mvc\Model\ResultsetInterface | null** |
$context | **string | null** |
$index | **int | null** |
appendMessagesFromRecordList
Appends messages from a record list to the current message container.
public appendMessagesFromRecordList(iterable|null $recordList = null, string|null $context = null, int|null $index = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$recordList | **iterable | null** |
$context | **string | null** |
$index | **int | null** |
rebuildMessageContext
Rebuilds the message context.
public rebuildMessageContext(\Phalcon\Messages\Message $message, string|null $context = null): string
This method appends the given context to the previous context stored in the message metadata. If there is no previous context, only the given context is returned.
Parameters:
Parameter | Type | Description |
---|---|---|
$message | \Phalcon\Messages\Message | The message object whose context needs to be rebuilt. |
$context | **string | null** |
Return Value:
The rebuilt context
rebuildMessageIndex
Rebuilds the message index.
public rebuildMessageIndex(\Phalcon\Messages\Message $message, int|null $index = null): string
This method constructs the new message index based on the provided $index argument and the previous index stored in the message's metadata. It returns the new index as a string.
Parameters:
Parameter | Type | Description |
---|---|---|
$message | \Phalcon\Messages\Message | The message object for which the index is being rebuilt. |
$index | **int | null** |
Return Value:
The new index as a string
relatedToArray
Retrieves the related records as an array.
public relatedToArray(array|null $columns = null, bool $useGetter = true): array
If $columns is provided, only the specified columns will be included in the array. If $useGetter is set to true, it will use the getter methods of the related records.
Parameters:
Parameter | Type | Description |
---|---|---|
$columns | **array | null** |
$useGetter | bool | (optional) Whether to use getter methods of the related records (default: true) |
Return Value:
The related records as an array
getRelated
Overriding default phalcon getRelated in order to fix an important issue where the related record is being stored into the "related" property and then passed from the collectRelatedToSave and is mistakenly saved without the user consent
public getRelated(string $alias, $arguments = null): false|int|\Phalcon\Mvc\Model\Resultset\Simple
Parameters:
Parameter | Type | Description |
---|---|---|
$alias | string | |
$arguments | **** |
Throws:
toArray
{@inheritDoc}
public toArray(mixed $columns = null, mixed $useGetter = true): array
Parameters:
Parameter | Type | Description |
---|---|---|
$columns | mixed | |
$useGetter | mixed |
setConnectionService
public setConnectionService(string $connectionService): void
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$connectionService | string |
setReadConnectionService
public setReadConnectionService(string $connectionService): void
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$connectionService | string |
setWriteConnectionService
public setWriteConnectionService(string $connectionService): void
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$connectionService | string |
getWriteConnectionService
public getWriteConnectionService(): string
- This method is abstract.
getReadConnectionService
public getReadConnectionService(): string
- This method is abstract.
getReplicationLag
Get the replication lag value in milliseconds
public static getReplicationLag(): ?int
- This method is static.
setReplicationLag
Set the replication lag value in milliseconds
public static setReplicationLag(?int $replicationLag = null): void
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$replicationLag | ?int |
getReplicationReadyAt
Get the replication lag value in milliseconds
public static getReplicationReadyAt(): ?int
- This method is static.
setReplicationReadyAt
Set the replication lag value in milliseconds
public static setReplicationReadyAt(?int $replicationReadyAt = null): void
- This method is static.
Parameters:
Parameter | Type | Description |
---|---|---|
$replicationReadyAt | ?int |
initializeReplication
Replication Trait Initialization - Set Read & Write Connection Service - Add Replication Behavior
public initializeReplication(?array $options = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$options | ?array |
selectReadConnection
Dynamically selects a shard - Prefer to read on the write master during the replica delay
public selectReadConnection(): \Phalcon\Db\Adapter\AdapterInterface
Possible parameters which can be added if required ?array $intermediate = null, array $bindParams = [], array $bindTypes = []
addReadWriteConnectionBehavior
Force write connection service to master if the model was previously saved
public addReadWriteConnectionBehavior(): void
isReplicationReady
Check whether the replica should be ready or not
public isReplicationReady(): bool
Return Value:
true if replica should be ready
initializeSecurity
Initializes the security
public initializeSecurity(array|null $options = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$options | **array | null** |
setSecurityBehavior
Sets the security behavior
public setSecurityBehavior(\Zemit\Mvc\Model\Behavior\Security $securityBehavior): void
Parameters:
Parameter | Type | Description |
---|---|---|
$securityBehavior | \Zemit\Mvc\Model\Behavior\Security | The security behavior to set. |
getSecurityBehavior
Retrieves the security behavior
public getSecurityBehavior(): \Zemit\Mvc\Model\Behavior\Security
Return Value:
The security behavior instance.
initializeSlug
Initializes the slug behavior for the model.
public initializeSlug(array|null $options = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$options | **array | null** |
setSlugBehavior
Sets the slug behavior for the model.
public setSlugBehavior(\Zemit\Mvc\Model\Behavior\Transformable $slugBehavior): void
Parameters:
Parameter | Type | Description |
---|---|---|
$slugBehavior | \Zemit\Mvc\Model\Behavior\Transformable | A Transformable object representing the slug behavior. |
getSlugBehavior
Returns the slug behavior associated with the model.
public getSlugBehavior(): \Zemit\Mvc\Model\Behavior\Transformable
Return Value:
The slug behavior associated with the model.
keepSnapshots
protected keepSnapshots(bool $keepSnapshot): void
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$keepSnapshot | bool |
initializeSnapshot
Initialize the snapshot for the model.
public initializeSnapshot(array|null $options = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$options | **array | null** |
setSnapshotBehavior
Set the SnapshotBehavior for the model
public setSnapshotBehavior(\Zemit\Mvc\Model\Behavior\Snapshot $snapshotBehavior): void
Parameters:
Parameter | Type | Description |
---|---|---|
$snapshotBehavior | \Zemit\Mvc\Model\Behavior\Snapshot | The SnapshotBehavior instance to set |
getSnapshotBehavior
Get the SnapshotBehavior instance for the model.
public getSnapshotBehavior(): \Zemit\Mvc\Model\Behavior\Snapshot
Return Value:
The SnapshotBehavior instance.
hasChangedCallback
Creates a closure that can be used as a callback to determine if a model attribute has changed.
public hasChangedCallback(callable $callback, bool $anyField = true): \Closure
Parameters:
Parameter | Type | Description |
---|---|---|
$callback | callable | The callback function to be executed if the model attribute has changed. |
$anyField | bool | Determines whether to check for changes in any field (default: true). |
Return Value:
A closure that takes a Model instance and a field name as arguments, and returns the result of the callback function if the attribute has changed, or the value of the attribute if it has not changed.
initializeSoftDelete
Initializing SoftDelete
public initializeSoftDelete(?array $options = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$options | ?array |
setSoftDeleteBehavior
Set the SoftDeleteBehavior variable Attach the SoftDelete behavior class
public setSoftDeleteBehavior(\Zemit\Mvc\Model\Behavior\SoftDelete $softDeleteBehavior): void
Parameters:
Parameter | Type | Description |
---|---|---|
$softDeleteBehavior | \Zemit\Mvc\Model\Behavior\SoftDelete |
getSoftDeleteBehavior
Return the soft delete behavior instance
public getSoftDeleteBehavior(): \Zemit\Mvc\Model\Behavior\SoftDelete
disableSoftDelete
Disable the soft delete for the current instance Note: Zemit SoftDelete behavior must be attached
public disableSoftDelete(): void
enableSoftDelete
Enable the soft delete for the current instance Note: Zemit SoftDelete behavior must be attached
public enableSoftDelete(): void
isDeleted
Helper method to check if the row is soft deleted
public isDeleted(?string $field = null, ?int $deletedValue = null): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$field | ?string | |
$deletedValue | ?int |
restore
Restore a previously Soft-deleted entry and fire events Events: - beforeRestore - notRestored - afterRestore
public restore(?string $field = null, ?int $notDeletedValue = null): bool
Parameters:
Parameter | Type | Description |
---|---|---|
$field | ?string | |
$notDeletedValue | ?int |
initializeUuid
Initializing Uuid
public initializeUuid(?array $options = null): void
Parameters:
Parameter | Type | Description |
---|---|---|
$options | ?array |
getBinaryUuid
Get Binary Uuid
private getBinaryUuid(string $uuid): string
Parameters:
Parameter | Type | Description |
---|---|---|
$uuid | string | The UUID string to convert to binary representation |
Return Value:
The binary representation of the given UUID
setUuidBehavior
Set Uuid Behavior
public setUuidBehavior(\Zemit\Mvc\Model\Behavior\Transformable $uuidBehavior): void
Parameters:
Parameter | Type | Description |
---|---|---|
$uuidBehavior | \Zemit\Mvc\Model\Behavior\Transformable |
getUuidBehavior
Get Uuid Behavior
public getUuidBehavior(): \Zemit\Mvc\Model\Behavior\Transformable
genericValidation
Apply generic validation to a validator object.
public genericValidation(\Zemit\Filter\Validation|null $validator = null): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | **\Zemit\Filter\Validation | null** |
Return Value:
The validator object with the generic validation rules applied.
addNotEmptyValidation
Add validation to ensure that a field is not empty
public addNotEmptyValidation(\Zemit\Filter\Validation $validator, array|string $field, bool $allowEmpty = false): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validation object to add the validation to |
$field | **array | string** |
$allowEmpty | bool | Whether to allow empty values. Default is false. |
Return Value:
The updated validation object
addPresenceValidation
Add presence validation to a field in a validator object
public addPresenceValidation(\Zemit\Filter\Validation $validator, array|string $field, bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validator object to add the validation to |
$field | **array | string** |
$allowEmpty | bool | Whether to allow empty values for the field or not (default: true) |
Return Value:
The modified validator object after adding the validation
addUnsignedIntValidation
Add validations for an unsigned integer field
public addUnsignedIntValidation(\Zemit\Filter\Validation $validator, array|string $field = 'id', bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validation object to add rules to |
$field | **array | string** |
$allowEmpty | bool | Whether to allow the field to be empty (default: true) |
Return Value:
The updated validation object with the added rules
addUnsignedBigIntValidation
Add basic validations for the specified field to ensure it is an unsigned big integer
public addUnsignedBigIntValidation(\Zemit\Filter\Validation $validator, array|string $field = 'id', bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validation object to add rules to |
$field | **array | string** |
$allowEmpty | bool | Whether empty values are allowed or not (default is true) |
Return Value:
The updated validation object
addNumberValidation
Add number validations for a given field
public addNumberValidation(\Zemit\Filter\Validation $validator, array|string $field, int $min, int $max, bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validation object to add the validations to |
$field | **array | string** |
$min | int | The minimum value allowed for the field |
$max | int | The maximum value allowed for the field |
$allowEmpty | bool | Specifies whether the field can be empty |
Return Value:
The modified validation object with the number validations added
addStringLengthValidation
Add string length validations for a field
public addStringLengthValidation(\Zemit\Filter\Validation $validator, array|string $field, int $minChar, int $maxChar = 255, bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validation object to add the validations to |
$field | **array | string** |
$minChar | int | The minimum number of characters allowed (default: 0) |
$maxChar | int | The maximum number of characters allowed (default: 255) |
$allowEmpty | bool | Whether empty values are allowed (default: true) |
Return Value:
The validation object with the added validations
addInclusionInValidation
Add inclusion validation for a field
public addInclusionInValidation(\Zemit\Filter\Validation $validator, array|string $field, array $domainList = [], bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validation object |
$field | **array | string** |
$domainList | array | The list of valid values for the field |
$allowEmpty | bool | Set to true to allow empty values (default: true) |
Return Value:
The updated validation object with the inclusion validation added
addBooleanValidation
Add basic validations for a boolean field - Must not be empty - Must be a boolean value (1, 0, true, false)
public addBooleanValidation(\Zemit\Filter\Validation $validator, array|string $field, bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validation object to add the validations to |
$field | **array | string** |
$allowEmpty | bool | Whether to allow empty values or not (default: true) |
Return Value:
The updated validation object
addInclusionValidation
Add inclusion validation for a specified field
public addInclusionValidation(\Zemit\Filter\Validation $validator, array|string $field, array $domain = [], bool $allowEmpty = true, bool $strict = true): \Zemit\Filter\Validation
This method adds an inclusion validation rule to the given validator object for the specified field. The inclusion rule checks if the value of the field is included in the specified domain.
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validator object to which the rule should be added |
$field | **array | string** |
$domain | array | The array of allowed values for the field |
$allowEmpty | bool | Whether to allow empty values for the field (default: true) |
$strict | bool | Whether to use strict comparison for checking inclusion (default: true) |
Return Value:
The updated validator object
addUniquenessValidation
Add uniqueness validation for the specified field(s)
public addUniquenessValidation(\Zemit\Filter\Validation $validator, string|array $field, bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validation object to add the validation rules to |
$field | **string | array** |
$allowEmpty | bool | Whether to allow empty values for the field(s) |
Return Value:
The modified validation object
addEmailValidation
Add email validation to a field
public addEmailValidation(\Zemit\Filter\Validation $validator, array|string $field, bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validator object |
$field | **array | string** |
$allowEmpty | bool | Whether to allow empty values for the field (default: true) |
Return Value:
The modified validator object
addDateValidation
Add basic validations for the date field - Must not be empty - Must be a valid date in the specified format
public addDateValidation(\Zemit\Filter\Validation $validator, array|string $field, bool $allowEmpty = true, string $format = Column::DATE_FORMAT): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validation object to add the validations to |
$field | **array | string** |
$allowEmpty | bool | Whether to allow empty values for the date field (default: true) |
$format | string | The expected format of the date field (default: Column::DATE_FORMAT) |
Return Value:
The updated validation object
addDateTimeValidation
Add basic validations for the datetime field - Must not be empty - Must be a valid datetime format
public addDateTimeValidation(\Zemit\Filter\Validation $validator, array|string $field, bool $allowEmpty = true, string $format = Column::DATETIME_FORMAT): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validation object |
$field | **array | string** |
$allowEmpty | bool | Specifies if the field is allowed to be empty (default: true) |
$format | string | The format of the datetime (default: Column::DATETIME_FORMAT) |
Return Value:
The updated validation object
addJsonValidation
Add validations for a JSON field - Must not be empty (unless allowEmpty is set to true) - Must be a valid JSON string
public addJsonValidation(\Zemit\Filter\Validation $validator, array|string $field, bool $allowEmpty = true, int $depth = 512, int $flags): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validator object to add the validations to |
$field | **array | string** |
$allowEmpty | bool | Whether to allow an empty value for the field |
$depth | int | The maximum depth of the JSON string (default: 512) |
$flags | int | JSON flags to be used (default: 0) |
Return Value:
The updated validator object
addColorValidation
Add basic validations for the color field - Must not be empty (unless $allowEmpty is set to true) - Must be a valid hex color code
public addColorValidation(\Zemit\Filter\Validation $validator, array|string $field, bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validation object |
$field | **array | string** |
$allowEmpty | bool | Whether empty values are allowed (default: true) |
Return Value:
The modified validation object
addIdValidation
Add basic validations for the id field - Must be an unsigned integer
public addIdValidation(\Zemit\Filter\Validation $validator, string $field = 'id'): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validation object to add validation rules to |
$field | string | The name of the field to add validations for (default: 'id') |
Return Value:
The updated validation object
addPositionValidation
Add position validation to a validator object.
public addPositionValidation(\Zemit\Filter\Validation $validator, string $field = 'position', bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validator object to add the validation rules to. |
$field | string | The field name to apply the validation rules to. Default is 'position'. |
$allowEmpty | bool | Whether empty values are allowed. Default is true. |
Return Value:
The updated validator object with the position validation added.
addSoftDeleteValidation
Add soft delete validation to a validator object.
public addSoftDeleteValidation(\Zemit\Filter\Validation $validator, string $field = 'deleted', bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validator object to add the validation rules to. |
$field | string | The field name to apply the validation rules to. Default is 'deleted'. |
$allowEmpty | bool | Whether empty values are allowed. Default is true. |
Return Value:
The updated validator object with the soft delete validation added.
addUuidValidation
Add UUID validation to a validator object.
public addUuidValidation(\Zemit\Filter\Validation $validator, string $field = 'uuid', bool $allowEmpty = false): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validator object to add the validation rules to. |
$field | string | The field name to apply the validation rules to. Default is 'uuid'. |
$allowEmpty | bool | Whether empty values are allowed. Default is false. |
Return Value:
The updated validator object with the UUID validation added.
addCrudValidation
Add CRUD validation to a validator object.
public addCrudValidation(\Zemit\Filter\Validation $validator, string $userIdField, string $dateField, bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validator object to add the validation rules to. |
$userIdField | string | The field name for the user ID validation rules. |
$dateField | string | The field name for the date validation rules. |
$allowEmpty | bool | Whether empty values are allowed. Default is true. |
Return Value:
The updated validator object with the CRUD validation added.
addCreatedValidation
Add created validation to a validator object.
public addCreatedValidation(\Zemit\Filter\Validation $validator, string $createdByField = 'createdBy', string $createdAtField = 'createdAt', bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validator object to add the validation rules to. |
$createdByField | string | The field name to apply the validation rules for the "created by" user. Default is 'createdBy'. |
$createdAtField | string | The field name to apply the validation rules for the "created at" timestamp. Default is 'createdAt'. |
$allowEmpty | bool | Whether empty values are allowed. Default is true. |
Return Value:
The updated validator object with the created validation added.
addUpdatedValidation
Add updated validation to a validator object.
public addUpdatedValidation(\Zemit\Filter\Validation $validator, string $updatedByField = 'updatedBy', string $updatedAtField = 'updatedAt', bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validator object to add the validation rules to. |
$updatedByField | string | The field name to apply the updated by validation rule to. Default is 'updatedBy'. |
$updatedAtField | string | The field name to apply the updated at validation rule to. Default is 'updatedAt'. |
$allowEmpty | bool | Whether empty values are allowed. Default is true. |
Return Value:
The updated validator object with the updated validation added.
addDeletedValidation
Add deleted validation to a validator object.
public addDeletedValidation(\Zemit\Filter\Validation $validator, string $deletedField = 'deletedBy', string $dateField = 'deletedAt', bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validator object to add the validation rules to. |
$deletedField | string | The field name to apply the validation rules to for deleted user. Default is 'deletedBy'. |
$dateField | string | The field name to apply the validation rules to for deletion date. Default is 'deletedAt'. |
$allowEmpty | bool | Whether empty values are allowed. Default is true. |
Return Value:
The updated validator object with the deleted validation added.
addRestoredValidation
Add restored validation to a validator object.
public addRestoredValidation(\Zemit\Filter\Validation $validator, string $restoredByField = 'restoredBy', string $restoredAtField = 'restoredAt', bool $allowEmpty = true): \Zemit\Filter\Validation
Parameters:
Parameter | Type | Description |
---|---|---|
$validator | \Zemit\Filter\Validation | The validator object to add the validation rules to. |
$restoredByField | string | The field name for the restored by information. Default is 'restoredBy'. |
$restoredAtField | string | The field name for the restored at information. Default is 'restoredAt'. |
$allowEmpty | bool | Whether empty values are allowed. Default is true. |
Return Value:
The updated validator object with the restored validation added.