Class luya\admin\models\StorageImage
Storage Image.
Public Properties
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$ngRestServiceArray | luya\admin\ngrest\base\NgRestModel |
Public Methods
Method | Description | Defined By |
---|---|---|
__call() | Calls the named method which is not a class method. | yii\base\Component |
__clone() | This method is called after the object is created by cloning an existing one. | yii\base\Model |
__construct() | Constructor. | luya\admin\ngrest\base\NgRestModel |
__get() | PHP getter magic method. | yii\db\BaseActiveRecord |
__isset() | Checks if a property value is null. | yii\db\BaseActiveRecord |
__set() | PHP setter magic method. | yii\db\BaseActiveRecord |
__unset() | Sets a component property to be null. | yii\db\BaseActiveRecord |
activeAttributes() | Returns the attribute names that are subject to validation in the current scenario. | yii\base\Model |
addError() | Adds a new error to the specified attribute. | yii\base\Model |
addErrors() | Adds a list of errors. | yii\base\Model |
addNgRestServiceData() | luya\admin\ngrest\base\NgRestModel | |
afterDelete() | This method is invoked after deleting a record. | yii\db\BaseActiveRecord |
afterFind() | This method is called when the AR object is created and populated with the query result. | luya\admin\ngrest\base\NgRestModel |
afterRefresh() | This method is called when the AR object is refreshed. | yii\db\BaseActiveRecord |
afterSave() | This method is called at the end of inserting or updating a record. | yii\db\BaseActiveRecord |
afterValidate() | This method is invoked after validation ends. | yii\base\Model |
attachBehavior() | Attaches a behavior to this component. | yii\base\Component |
attachBehaviors() | Attaches a list of behaviors to the component. | yii\base\Component |
attributeHints() | Returns the attribute hints. | yii\base\Model |
attributeLabels() | Returns the attribute labels. | luya\admin\models\StorageImage |
attributes() | Returns the list of all attribute names of the model. | yii\db\ActiveRecord |
beforeDelete() | This method is invoked before deleting a record. | luya\admin\models\StorageImage |
beforeSave() | This method is called at the beginning of inserting or updating a record. | yii\db\BaseActiveRecord |
beforeValidate() | This method is invoked before validation starts. | yii\base\Model |
behaviors() | Returns a list of behaviors that this component should behave as. | luya\admin\models\StorageImage |
canGetProperty() | Returns a value indicating whether a property can be read. | yii\db\BaseActiveRecord |
canSetProperty() | Returns a value indicating whether a property can be set. | yii\db\BaseActiveRecord |
className() | Returns the fully qualified name of this class. | yii\base\BaseObject |
clearErrors() | Removes errors for all attributes or a single attribute. | yii\base\Model |
createValidators() | Creates validator objects based on the validation rules specified in rules(). | yii\base\Model |
delete() | Deletes the table row corresponding to this active record. | yii\db\ActiveRecord |
deleteAll() | Deletes rows in the table using the provided conditions. | yii\db\ActiveRecord |
deleteSource() | Delete the source of this image. | luya\admin\models\StorageImage |
detachBehavior() | Detaches a behavior from the component. | yii\base\Component |
detachBehaviors() | Detaches all behaviors from the component. | yii\base\Component |
ensureBehaviors() | Makes sure that the behaviors declared in behaviors() are attached to this component. | yii\base\Component |
equals() | Returns a value indicating whether the given active record is the same as the current one. | yii\db\ActiveRecord |
extraFields() | Returns the list of fields that can be expanded further and returned by toArray(). | luya\admin\models\StorageImage |
fields() | Returns the list of fields that should be returned by default by toArray() when no specific fields are specified. | luya\admin\models\StorageImage |
find() | Creates an yii\db\ActiveQueryInterface instance for query purpose. | luya\admin\ngrest\base\NgRestModel |
findActiveQueryBehaviors() | Attach behaviors to the Active Query. | luya\admin\ngrest\base\NgRestModel |
findAll() | Returns a list of active record models that match the specified primary key value(s) or a set of column values. | yii\db\BaseActiveRecord |
findBySql() | Creates an yii\db\ActiveQuery instance with a given SQL statement. | yii\db\ActiveRecord |
findLatestPrimaryKeyValue() | Get an array with the latest primary key value. | luya\admin\ngrest\base\NgRestModel |
findOne() | Returns a single active record model instance by a primary key or an array of column values. | yii\db\BaseActiveRecord |
formName() | Returns the form name that this model class should use. | yii\base\Model |
generateAttributeLabel() | Generates a user friendly attribute label based on the give attribute name. | yii\base\Model |
generateNgRestRelations() | Generate an array with NgRestRelation objects | luya\admin\ngrest\base\NgRestModel |
genericSearch() | The Query which is going to be performend to the concret implementation. | luya\admin\ngrest\base\NgRestModel |
genericSearchFields() | The fields to lookup with the search query. | luya\admin\ngrest\base\NgRestModel |
genericSearchHiddenFields() | An array with fields which will be hidden in the search output, but are available for the State Provider functions. | luya\admin\ngrest\base\NgRestModel |
genericSearchStateProvider() | The state provider is used to click on the items. Retuns an array with a configuration for the angular state provider. Example | luya\admin\ngrest\base\NgRestModel |
getActiveValidators() | Returns the validators applicable to the current $scenario. | yii\base\Model |
getAttribute() | Returns the named attribute value. | yii\db\BaseActiveRecord |
getAttributeHint() | Returns the text hint for the specified attribute. | yii\db\BaseActiveRecord |
getAttributeLabel() | Returns the text label for the specified attribute. | yii\db\BaseActiveRecord |
getAttributes() | Returns attribute values. | yii\base\Model |
getBehavior() | Returns the named behavior object. | yii\base\Component |
getBehaviors() | Returns all behaviors attached to this component. | yii\base\Component |
getDb() | Returns the database connection used by this AR class. | yii\db\ActiveRecord |
getDirtyAttributes() | Returns the attribute values that have been modified since they are loaded or saved most recently. | yii\db\BaseActiveRecord |
getErrorSummary() | Returns the errors for all attributes as a one-dimensional array. | yii\base\Model |
getErrors() | Returns the errors for all attributes or a single attribute. | yii\base\Model |
getFile() | luya\admin\models\StorageImage | |
getFileExists() | Return boolean value whether the file server source exsits on the server or not. | luya\admin\models\StorageImage |
getFilter() | Get Storage Filter. | luya\admin\models\StorageImage |
getFilterImage() | The relation for an storage image with the given filter identifier | luya\admin\models\StorageImage |
getFirstError() | Returns the first error of the specified attribute. | yii\base\Model |
getFirstErrors() | Returns the first error of every attribute in the model. | yii\base\Model |
getI18nOldValue() | Get the old/original i18n value from the database. | luya\admin\ngrest\base\NgRestModel |
getImages() | Get all related images | luya\admin\models\StorageImage |
getIsNewRecord() | Returns a value indicating whether the current record is new. | yii\db\BaseActiveRecord |
getIsNgRestContext() | Whether the current model is in api context (REST SCENARIOS or CALL TYPE) context or not. | luya\admin\ngrest\base\NgRestModel |
getIterator() | Returns an iterator for traversing the attributes in the model. | yii\base\Model |
getMediumThumbnailImage() | Return a storage image object representing the medium thumbail which is used for file manager and crud list previews. | luya\admin\models\StorageImage |
getNgRestCallType() | Determine the current call type based on get params as they can change the output behavior to make the ngrest crud list view. | luya\admin\ngrest\base\NgRestModel |
getNgRestConfig() | Build and call the full config object if not build yet for this model. | luya\admin\ngrest\base\NgRestModel |
getNgRestPrimaryKey() | Getter method for NgRest Primary Key. | luya\admin\ngrest\base\NgRestModel |
getNgRestRelationByIndex() | Get the NgRest Relation definition object. | luya\admin\ngrest\base\NgRestModel |
getNgRestScopeConfigOptions() | Return the scope definition third entry looking for button condition Currently support only buttonCondition | luya\admin\ngrest\base\NgRestModel |
getNgRestServices() | Triggers the event service event and returns the resolved data. | luya\admin\ngrest\base\NgRestModel |
getOldAttribute() | Returns the old value of the named attribute. | yii\db\BaseActiveRecord |
getOldAttributes() | Returns the old attribute values. | yii\db\BaseActiveRecord |
getOldPrimaryKey() | Returns the old primary key value(s). | yii\db\BaseActiveRecord |
getPrimaryKey() | Returns the primary key value(s). | yii\db\BaseActiveRecord |
getRelatedRecords() | Returns all populated related records. | yii\db\BaseActiveRecord |
getRelation() | Returns the relation object with the specified name. | yii\db\BaseActiveRecord |
getScenario() | Returns the scenario that this model is used in. | yii\base\Model |
getServerSource() | Get the path to the source files internal, on the servers path. | luya\admin\models\StorageImage |
getSource() | Returns the current file source path for the current filter image. | luya\admin\models\StorageImage |
getTableSchema() | Returns the schema information of the DB table associated with this AR class. | yii\db\ActiveRecord |
getTinyCropImage() | Return a storage image object representing the tiny crop which is used for file manager and crud list previews. | luya\admin\models\StorageImage |
getValidators() | Returns all the validators declared in rules(). | yii\base\Model |
handleNgRestActiveButton() | Handle a given active button based on the hash (classname in sha1). | luya\admin\ngrest\base\NgRestModel |
hasAttribute() | Returns a value indicating whether the model has an attribute with the specified name. | yii\db\BaseActiveRecord |
hasErrors() | Returns a value indicating whether there is any validation error. | yii\base\Model |
hasEventHandlers() | Returns a value indicating whether there is any handler attached to the named event. | yii\base\Component |
hasMany() | See yii\db\BaseActiveRecord::hasMany() for more info. | yii\db\ActiveRecord |
hasMethod() | Returns a value indicating whether a method is defined. | yii\base\Component |
hasOne() | See yii\db\BaseActiveRecord::hasOne() for more info. | yii\db\ActiveRecord |
hasProperty() | Returns a value indicating whether a property is defined for this component. | yii\base\Component |
i18nAttributeFallbackValue() | Returns the value for an i18n field before it was casted to the output for the current active language if empty. | luya\admin\ngrest\base\NgRestModel |
i18nAttributeLanguageValue() | Returns the value of an i18n attribute for the given language. | luya\admin\ngrest\base\NgRestModel |
i18nAttributeValue() | Checks whether given attribute is in the list of i18n fields, if so the field value will be decoded and the value for the current active language is returned. | luya\admin\ngrest\base\NgRestModel |
i18nAttributesValue() | Returns the decoded i18n value for a set of attributes. | luya\admin\ngrest\base\NgRestModel |
imageFilter() | Get an image for a given filter id of the current image. | luya\admin\models\StorageImage |
init() | Initializes the object. | yii\db\BaseActiveRecord |
insert() | Inserts a row into the associated database table using the attribute values of this record. | yii\db\ActiveRecord |
instance() | Returns static class instance, which can be used to obtain meta information. | yii\base\StaticInstanceTrait |
instantiate() | Creates an active record instance. | yii\db\BaseActiveRecord |
isAttributeActive() | Returns a value indicating whether the attribute is active in the current scenario. | yii\base\Model |
isAttributeChanged() | Returns a value indicating whether the named attribute has been changed. | yii\db\BaseActiveRecord |
isAttributeRequired() | Returns a value indicating whether the attribute is required. | yii\base\Model |
isAttributeSafe() | Returns a value indicating whether the attribute is safe for massive assignments. | yii\base\Model |
isI18n() | Whether a field is i18n or not. | luya\admin\ngrest\base\NgRestModel |
isPrimaryKey() | Returns a value indicating whether the given set of attributes represents the primary key for this model. | yii\db\BaseActiveRecord |
isRelationPopulated() | Check whether the named relation has been populated with records. | yii\db\BaseActiveRecord |
isTransactional() | Returns a value indicating whether the specified operation is transactional in the current $scenario. | yii\db\ActiveRecord |
link() | Establishes the relationship between two models. | yii\db\BaseActiveRecord |
load() | Populates the model with input data. | yii\base\Model |
loadDefaultValues() | Loads default values from database table schema. | yii\db\ActiveRecord |
loadMultiple() | Populates a set of models with the data from end user. | yii\base\Model |
markAttributeDirty() | Marks an attribute dirty. | yii\db\BaseActiveRecord |
ngRestActiveButtons() | Define Active Buttons. | luya\admin\ngrest\base\NgRestModel |
ngRestActiveSelections() | Define Active Selections. | luya\admin\ngrest\base\NgRestModel |
ngRestActiveWindows() | Define Active Window configurations. | luya\admin\ngrest\base\NgRestModel |
ngRestApiEndpoint() | Defines the Api Endpoint for the current Active Record model. | luya\admin\models\StorageImage |
ngRestAttributeGroups() | Grouping fields into fieldset similar group names which can be collapsed by default or not: | luya\admin\ngrest\base\NgRestModel |
ngRestAttributeTypes() | Define the field types for ngrest, to use ngRestConfigDefine() . |
luya\admin\models\StorageImage |
ngRestByPrimaryKeyOne() | The a single object from a primary key definition. | luya\admin\ngrest\base\NgRestModel |
ngRestConfig() | Defines the base inline configuration for the current Model. | luya\admin\ngrest\base\NgRestModel |
ngRestConfigDefine() | Inject data from the model into the config, usage exmple in ngRestConfig method context: | luya\admin\ngrest\base\NgRestModel |
ngRestConfigOptions() | The NgRest config has an options property which can contain a variaty of definitions. | luya\admin\ngrest\base\NgRestModel |
ngRestExport() | Format the values for export generator. | luya\admin\ngrest\base\NgRestModel |
ngRestExtraAttributeTypes() | Same as ngRestAttributeTypes() but used for extraField instead of field. | luya\admin\ngrest\base\NgRestModel |
ngRestFilters() | Define an array with filters you can select from the CRUD list. | luya\admin\ngrest\base\NgRestModel |
ngRestFind() | The NgRestFind is used when performing the crud list index overivew. You can override this method in order to hide data from the ngRestFind command which populates all data from the database. | luya\admin\ngrest\base\NgRestModel |
ngRestFullQuerySearch() | Search trough the whole table as ajax fallback when pagination is enabled. | luya\admin\models\StorageImage |
ngRestGroupByExpanded() | When enabled, the field groups in the form are by default expanded (open) or not (closed). | luya\admin\ngrest\base\NgRestModel |
ngRestGroupByField() | Enable the Grouping by a field option by default. Allows you to predefine the default group field. | luya\admin\ngrest\base\NgRestModel |
ngRestListOrder() | Define the default ordering for the ngrest list when loading, by default the primary key sorted ascending is used. To override the method for example sorting by a timestamp field: | luya\admin\ngrest\base\NgRestModel |
ngRestPools() | Define data pools. | luya\admin\ngrest\base\NgRestModel |
ngRestRelations() | Define your relations in order to access the relation data and manage them directly in the same view. | luya\admin\ngrest\base\NgRestModel |
ngRestScopes() | Defines the scope which field should be used for what situation. | luya\admin\models\StorageImage |
off() | Detaches an existing event handler from this component. | yii\base\Component |
offsetExists() | Returns whether there is an element at the specified offset. | yii\db\BaseActiveRecord |
offsetGet() | Returns the element at the specified offset. | yii\base\Model |
offsetSet() | Sets the element at the specified offset. | yii\base\Model |
offsetUnset() | Sets the element value at the specified offset to null. | yii\db\BaseActiveRecord |
on() | Attaches an event handler to an event. | yii\base\Component |
onUnsafeAttribute() | This method is invoked when an unsafe attribute is being massively assigned. | yii\base\Model |
optimisticLock() | Returns the name of the column that stores the lock version for implementing optimistic locking. | yii\db\BaseActiveRecord |
populateRecord() | Populates an active record object using a row of data from the database/storage. | yii\db\ActiveRecord |
populateRelation() | Populates the named relation with the related records. | yii\db\BaseActiveRecord |
primaryKey() | Returns the primary key name(s) for this AR class. | yii\db\ActiveRecord |
refresh() | Repopulates this active record with the latest data. | yii\db\ActiveRecord |
rules() | Returns the validation rules for attributes. | luya\admin\models\StorageImage |
safeAttributes() | Returns the attribute names that are safe to be massively assigned in the current scenario. | yii\base\Model |
save() | Saves the current record. | yii\db\BaseActiveRecord |
scenarios() | Returns a list of scenarios and the corresponding active attributes. | luya\admin\ngrest\base\NgRestModel |
setAttribute() | Sets the named attribute value. | yii\db\BaseActiveRecord |
setAttributes() | Sets the attribute values in a massive way. | yii\base\Model |
setI18nOldValue() | Set the old json value from a i18n database value. | luya\admin\ngrest\base\NgRestModel |
setIsNewRecord() | Sets the value indicating whether the record is new. | yii\db\BaseActiveRecord |
setNgRestPrimaryKey() | Setter method for NgRest Primary Key | luya\admin\ngrest\base\NgRestModel |
setOldAttribute() | Sets the old value of the named attribute. | yii\db\BaseActiveRecord |
setOldAttributes() | Sets the old attribute values. | yii\db\BaseActiveRecord |
setScenario() | Sets the scenario for the model. | yii\base\Model |
tableName() | Declares the name of the database table associated with this AR class. | luya\admin\models\StorageImage |
toArray() | Converts the model into an array. | yii\base\ArrayableTrait |
transactions() | Declares which DB operations should be performed within a transaction in different scenarios. | yii\db\ActiveRecord |
trigger() | Triggers an event. | yii\base\Component |
unlink() | Destroys the relationship between two models. | yii\db\BaseActiveRecord |
unlinkAll() | Destroys the relationship in current model. | yii\db\BaseActiveRecord |
update() | Saves the changes to this active record into the associated database table. | yii\db\ActiveRecord |
updateAll() | Updates the whole table using the provided attribute values and conditions. | yii\db\ActiveRecord |
updateAllCounters() | Updates the whole table using the provided counter changes and conditions. | yii\db\ActiveRecord |
updateAttributes() | Updates the specified attributes. | yii\db\BaseActiveRecord |
updateCounters() | Updates one or several counter columns for the current AR object. | yii\db\BaseActiveRecord |
validate() | Performs the data validation. | yii\base\Model |
validateMultiple() | Validates multiple models. | yii\base\Model |
Protected Methods
Method | Description | Defined By |
---|---|---|
createRelationQuery() | Creates a query instance for has-one or has-many relation. |
yii\db\BaseActiveRecord |
deleteInternal() | Deletes an ActiveRecord without considering transaction. | yii\db\ActiveRecord |
extractFieldsFor() | Extract nested fields from a fields collection for a given root field Nested fields are separated with dots (.). e.g: "item.id" The previous example would extract "id". | yii\base\ArrayableTrait |
extractRootFields() | Extracts the root field names from nested fields. | yii\base\ArrayableTrait |
insertInternal() | Inserts an ActiveRecord into DB without considering transaction. | yii\db\ActiveRecord |
refreshInternal() | Repopulates this active record with the latest data from a newly fetched instance. | yii\db\BaseActiveRecord |
resolveFields() | Determines which fields can be returned by toArray(). | yii\base\ArrayableTrait |
runI18nContextOnFindPlugin() | Run an attribute plugin in i18n context in order to ensure plugin functions. | luya\admin\ngrest\base\NgRestModel |
updateInternal() | yii\db\BaseActiveRecord |
Events
Event | Type | Description | Defined By |
---|---|---|---|
EVENT_AFTER_DELETE | yii\db\Event | An event that is triggered after a record is deleted. | yii\db\BaseActiveRecord |
EVENT_AFTER_FIND | yii\db\Event | An event that is triggered after the record is created and populated with query result. | yii\db\BaseActiveRecord |
EVENT_AFTER_INSERT | yii\db\AfterSaveEvent | An event that is triggered after a record is inserted. | yii\db\BaseActiveRecord |
EVENT_AFTER_REFRESH | yii\db\Event | An event that is triggered after a record is refreshed. (available since version 2.0.8) | yii\db\BaseActiveRecord |
EVENT_AFTER_UPDATE | yii\db\AfterSaveEvent | An event that is triggered after a record is updated. | yii\db\BaseActiveRecord |
EVENT_AFTER_VALIDATE | yii\base\Event | An event raised at the end of validate() | yii\base\Model |
EVENT_BEFORE_DELETE | yii\base\ModelEvent | An event that is triggered before deleting a record. | yii\db\BaseActiveRecord |
EVENT_BEFORE_INSERT | yii\base\ModelEvent | An event that is triggered before inserting a record. | yii\db\BaseActiveRecord |
EVENT_BEFORE_UPDATE | yii\base\ModelEvent | An event that is triggered before updating a record. | yii\db\BaseActiveRecord |
EVENT_BEFORE_VALIDATE | yii\base\ModelEvent | An event raised at the beginning of validate(). | yii\base\Model |
EVENT_INIT | yii\db\Event | An event that is triggered when the record is initialized via init(). | yii\db\BaseActiveRecord |
Constants
Constant | Value | Description | Defined By |
---|---|---|---|
EVENT_AFTER_NGREST_FIND | 'afterNgrestFind' | luya\admin\ngrest\base\NgRestModel | |
EVENT_AFTER_NGREST_UPDATE_FIND | 'afterNgrestUpdateFind' | luya\admin\ngrest\base\NgRestModel | |
EVENT_SERVICE_NGREST | 'serviceNgrest' | luya\admin\ngrest\base\NgRestModel | |
OP_ALL | 0x7 | All three operations: insert, update, delete. This is a shortcut of the expression: OP_INSERT | OP_UPDATE | OP_DELETE. | yii\db\ActiveRecord |
OP_DELETE | 0x4 | The delete operation. This is mainly used when overriding transactions() to specify which operations are transactional. | yii\db\ActiveRecord |
OP_INSERT | 0x1 | The insert operation. This is mainly used when overriding transactions() to specify which operations are transactional. | yii\db\ActiveRecord |
OP_UPDATE | 0x2 | The update operation. This is mainly used when overriding transactions() to specify which operations are transactional. | yii\db\ActiveRecord |
SCENARIO_DEFAULT | 'default' | The name of the default scenario. | yii\base\Model |
SCENARIO_RESTCREATE | \luya\admin\base\RestActiveController::SCENARIO_RESTCREATE | luya\admin\ngrest\base\NgRestModel | |
SCENARIO_RESTUPDATE | \luya\admin\base\RestActiveController::SCENARIO_RESTUPDATE | luya\admin\ngrest\base\NgRestModel |
Property Details
Method Details
Defined in: yii\base\Component::__call()
Calls the named method which is not a class method.
This method will check if any attached behavior has the named method and will execute it if available.
Do not call this method directly as it is a PHP magic method that will be implicitly called when an unknown method is being invoked.
public mixed __call ( $name, $params ) | ||
$name | string |
The method name |
$params | array |
Method parameters |
return | mixed |
The method return value |
---|---|---|
throws | yii\base\UnknownMethodException |
when calling unknown method |
public function __call($name, $params)
{
$this->ensureBehaviors();
foreach ($this->_behaviors as $object) {
if ($object->hasMethod($name)) {
return call_user_func_array([$object, $name], $params);
}
}
throw new UnknownMethodException('Calling unknown method: ' . get_class($this) . "::$name()");
}
Defined in: yii\base\Model::__clone()
This method is called after the object is created by cloning an existing one.
It removes all behaviors because they are attached to the old object.
public void __clone ( ) |
public function __clone()
{
parent::__clone();
$this->_errors = null;
$this->_validators = null;
}
Defined in: luya\admin\ngrest\base\NgRestModel::__construct()
Constructor.
The default implementation does two things:
- Initializes the object with the given configuration
$config
. - Call init().
If this method is overridden in a child class, it is recommended that
- the last parameter of the constructor is a configuration array, like
$config
here. - call the parent implementation at the end of the constructor.
public void __construct ( $config = [] ) | ||
$config | array |
Name-value pairs that will be used to initialize the object properties |
public function __construct($config = [])
{
$this->attachBehaviors([
'NgRestEventBehavior' => [
'class' => NgRestEventBehavior::class,
'plugins' => $this->getNgRestConfig()->getPlugins(),
],
'LogBehavior' => [
'class' => LogBehavior::class,
'api' => static::ngRestApiEndpoint(),
],
]);
parent::__construct($config);
}
Defined in: yii\db\BaseActiveRecord::__get()
PHP getter magic method.
This method is overridden so that attributes and related objects can be accessed like properties.
See also getAttribute().
public mixed __get ( $name ) | ||
$name | string |
Property name |
return | mixed |
Property value |
---|---|---|
throws | yii\base\InvalidArgumentException |
if relation name is wrong |
public function __get($name)
{
if (isset($this->_attributes[$name]) || array_key_exists($name, $this->_attributes)) {
return $this->_attributes[$name];
}
if ($this->hasAttribute($name)) {
return null;
}
if (isset($this->_related[$name]) || array_key_exists($name, $this->_related)) {
return $this->_related[$name];
}
$value = parent::__get($name);
if ($value instanceof ActiveQueryInterface) {
$this->setRelationDependencies($name, $value);
return $this->_related[$name] = $value->findFor($name, $this);
}
return $value;
}
Defined in: yii\db\BaseActiveRecord::__isset()
Checks if a property value is null.
This method overrides the parent implementation by checking if the named attribute is null
or not.
public boolean __isset ( $name ) | ||
$name | string |
The property name or the event name |
return | boolean |
Whether the property value is null |
---|
public function __isset($name)
{
try {
return $this->__get($name) !== null;
} catch (\Exception $t) {
return false;
} catch (\Throwable $e) {
return false;
}
}
Defined in: yii\db\BaseActiveRecord::__set()
PHP setter magic method.
This method is overridden so that AR attributes can be accessed like properties.
public void __set ( $name, $value ) | ||
$name | string |
Property name |
$value | mixed |
Property value |
public function __set($name, $value)
{
if ($this->hasAttribute($name)) {
if (
!empty($this->_relationsDependencies[$name])
&& (!array_key_exists($name, $this->_attributes) || $this->_attributes[$name] !== $value)
) {
$this->resetDependentRelations($name);
}
$this->_attributes[$name] = $value;
} else {
parent::__set($name, $value);
}
}
Defined in: yii\db\BaseActiveRecord::__unset()
Sets a component property to be null.
This method overrides the parent implementation by clearing the specified attribute value.
public void __unset ( $name ) | ||
$name | string |
The property name or the event name |
public function __unset($name)
{
if ($this->hasAttribute($name)) {
unset($this->_attributes[$name]);
if (!empty($this->_relationsDependencies[$name])) {
$this->resetDependentRelations($name);
}
} elseif (array_key_exists($name, $this->_related)) {
unset($this->_related[$name]);
} elseif ($this->getRelation($name, false) === null) {
parent::__unset($name);
}
}
Defined in: yii\base\Model::activeAttributes()
Returns the attribute names that are subject to validation in the current scenario.
public string[] activeAttributes ( ) | ||
return | string[] |
Safe attribute names |
---|
public function activeAttributes()
{
$scenario = $this->getScenario();
$scenarios = $this->scenarios();
if (!isset($scenarios[$scenario])) {
return [];
}
$attributes = array_keys(array_flip($scenarios[$scenario]));
foreach ($attributes as $i => $attribute) {
if (strncmp($attribute, '!', 1) === 0) {
$attributes[$i] = substr($attribute, 1);
}
}
return $attributes;
}
Defined in: yii\base\Model::addError()
Adds a new error to the specified attribute.
public void addError ( $attribute, $error = '' ) | ||
$attribute | string |
Attribute name |
$error | string |
New error message |
public function addError($attribute, $error = '')
{
$this->_errors[$attribute][] = $error;
}
Defined in: yii\base\Model::addErrors()
Adds a list of errors.
public void addErrors ( array $items ) | ||
$items | array |
A list of errors. The array keys must be attribute names. The array values should be error messages. If an attribute has multiple errors, these errors must be given in terms of an array. You may use the result of getErrors() as the value for this parameter. |
public function addErrors(array $items)
{
foreach ($items as $attribute => $errors) {
if (is_array($errors)) {
foreach ($errors as $error) {
$this->addError($attribute, $error);
}
} else {
$this->addError($attribute, $errors);
}
}
}
public void addNgRestServiceData ( $field, $data ) | ||
$field | string | |
$data | mixed |
public function addNgRestServiceData($field, $data)
{
$this->ngRestServiceArray[$field] = $data;
}
Defined in: yii\db\BaseActiveRecord::afterDelete()
This method is invoked after deleting a record.
The default implementation raises the EVENT_AFTER_DELETE event. You may override this method to do postprocessing after the record is deleted. Make sure you call the parent implementation so that the event is raised properly.
public void afterDelete ( ) |
public function afterDelete()
{
$this->trigger(self::EVENT_AFTER_DELETE);
}
Defined in: luya\admin\ngrest\base\NgRestModel::afterFind()
This method is called when the AR object is created and populated with the query result.
The default implementation will trigger an EVENT_AFTER_FIND event. When overriding this method, make sure you call the parent implementation to ensure the event is triggered.
public void afterFind ( ) |
public function afterFind()
{
if ($this->getNgRestCallType()) {
if ($this->getNgRestCallType() == 'list') {
$this->trigger(self::EVENT_AFTER_NGREST_FIND);
}
if ($this->getNgRestCallType() == 'update') {
$this->trigger(self::EVENT_AFTER_NGREST_UPDATE_FIND);
}
} else {
return parent::afterFind();
}
}
Defined in: yii\db\BaseActiveRecord::afterRefresh()
This method is called when the AR object is refreshed.
The default implementation will trigger an EVENT_AFTER_REFRESH event. When overriding this method, make sure you call the parent implementation to ensure the event is triggered.
public void afterRefresh ( ) |
public function afterRefresh()
{
$this->trigger(self::EVENT_AFTER_REFRESH);
}
Defined in: yii\db\BaseActiveRecord::afterSave()
This method is called at the end of inserting or updating a record.
The default implementation will trigger an EVENT_AFTER_INSERT event when $insert
is true
,
or an EVENT_AFTER_UPDATE event if $insert
is false
. The event class used is yii\db\AfterSaveEvent.
When overriding this method, make sure you call the parent implementation so that
the event is triggered.
public void afterSave ( $insert, $changedAttributes ) | ||
$insert | boolean |
Whether this method called while inserting a record.
If |
$changedAttributes | array |
The old values of attributes that had changed and were saved.
You can use this parameter to take action based on the changes made for example send an email
when the password had changed or implement audit trail that tracks all the changes.
Note that no automatic type conversion performed by default. You may use yii\behaviors\AttributeTypecastBehavior to facilitate attribute typecasting. See https://www.yiiframework.com/doc-2.0/guide-db-active-record.html#attributes-typecasting. |
public function afterSave($insert, $changedAttributes)
{
$this->trigger($insert ? self::EVENT_AFTER_INSERT : self::EVENT_AFTER_UPDATE, new AfterSaveEvent([
'changedAttributes' => $changedAttributes,
]));
}
Defined in: yii\base\Model::afterValidate()
This method is invoked after validation ends.
The default implementation raises an afterValidate
event.
You may override this method to do postprocessing after validation.
Make sure the parent implementation is invoked so that the event can be raised.
public void afterValidate ( ) |
public function afterValidate()
{
$this->trigger(self::EVENT_AFTER_VALIDATE);
}
Defined in: yii\base\Component::attachBehavior()
Attaches a behavior to this component.
This method will create the behavior object based on the given configuration. After that, the behavior object will be attached to this component by calling the yii\base\Behavior::attach() method.
See also detachBehavior().
public yii\base\Behavior attachBehavior ( $name, $behavior ) | ||
$name | string |
The name of the behavior. |
$behavior | string|array|yii\base\Behavior |
The behavior configuration. This can be one of the following:
|
return | yii\base\Behavior |
The behavior object |
---|
public function attachBehavior($name, $behavior)
{
$this->ensureBehaviors();
return $this->attachBehaviorInternal($name, $behavior);
}
Defined in: yii\base\Component::attachBehaviors()
Attaches a list of behaviors to the component.
Each behavior is indexed by its name and should be a yii\base\Behavior object, a string specifying the behavior class, or an configuration array for creating the behavior.
See also attachBehavior().
public void attachBehaviors ( $behaviors ) | ||
$behaviors | array |
List of behaviors to be attached to the component |
public function attachBehaviors($behaviors)
{
$this->ensureBehaviors();
foreach ($behaviors as $name => $behavior) {
$this->attachBehaviorInternal($name, $behavior);
}
}
Defined in: yii\base\Model::attributeHints()
Returns the attribute hints.
Attribute hints are mainly used for display purpose. For example, given an attribute
isPublic
, we can declare a hint Whether the post should be visible for not logged in users
,
which provides user-friendly description of the attribute meaning and can be displayed to end users.
Unlike label hint will not be generated, if its explicit declaration is omitted.
Note, in order to inherit hints defined in the parent class, a child class needs to
merge the parent hints with child hints using functions such as array_merge()
.
public array attributeHints ( ) | ||
return | array |
Attribute hints (name => hint) |
---|
public function attributeHints()
{
return [];
}
Returns the attribute labels.
Attribute labels are mainly used for display purpose. For example, given an attribute
firstName
, we can declare a label First Name
which is more user-friendly and can
be displayed to end users.
By default an attribute label is generated using generateAttributeLabel(). This method allows you to explicitly specify attribute labels.
Note, in order to inherit labels defined in the parent class, a child class needs to
merge the parent labels with child labels using functions such as array_merge()
.
public array attributeLabels ( ) | ||
return | array |
Attribute labels (name => label) |
---|
public function attributeLabels()
{
return [
'file_id' => Module::t('model_storageimage_file_id_label'),
'filter_id' => Module::t('model_storageimage_filter_id_label'),
'resolution_width' => Module::t('model_storageimage_resolution_width_label'),
'resolution_height' => Module::t('model_storageimage_resolution_height_label'),
];
}