db\BaseActiveRecord setOldAttributes()

setOldAttributes() public method Sets the old attribute values. All existing old attribute values will be discarded. public void setOldAttributes ( $values )$values array|null Old attribute values to be set. If set to null this record is considered to be new.

db\BaseActiveRecord setOldAttribute()

setOldAttribute() public method Sets the old value of the named attribute. See also hasAttribute(). public void setOldAttribute ( $name, $value )$name string The attribute name $value mixed The old attribute value. throws yii\base\InvalidParamException if the named attribute does not exist.

db\BaseActiveRecord setIsNewRecord()

setIsNewRecord() public method Sets the value indicating whether the record is new. See also getIsNewRecord(). public void setIsNewRecord ( $value )$value boolean Whether the record is new and should be inserted when calling save().

db\BaseActiveRecord setAttribute()

setAttribute() public method Sets the named attribute value. See also hasAttribute(). public void setAttribute ( $name, $value )$name string The attribute name $value mixed The attribute value. throws yii\base\InvalidParamException if the named attribute does not exist.

db\BaseActiveRecord save()

save() public method Saves the current record. This method will call insert() when $isNewRecord is true, or update() when $isNewRecord is false. For example, to save a customer record: $customer = new Customer; // or $customer = Customer::findOne($id); $customer->name = $name; $customer->email = $email; $customer->save(); public boolean save ( $runValidation = true, $attributeNames = null )$runValidation boolean Whether to perform validation (calling validate()) before saving t

db\BaseActiveRecord refresh()

refresh() public method Repopulates this active record with the latest data. If the refresh is successful, an EVENT_AFTER_REFRESH event will be triggered. This event is available since version 2.0.8. public boolean refresh ( )return boolean Whether the row still exists in the database. If true, the latest data will be populated to this active record. Otherwise, this record will remain unchanged.

db\BaseActiveRecord populateRelation()

populateRelation() public method Populates the named relation with the related records. Note that this method does not check if the relation exists or not. See also getRelation(). public void populateRelation ( $name, $records )$name string The relation name, e.g. orders for a relation defined via getOrders() method (case-sensitive). $records yii\db\ActiveRecordInterface|array|null The related records to be populated into the relation.

db\BaseActiveRecord populateRecord()

populateRecord() public static method Populates an active record object using a row of data from the database/storage. This is an internal method meant to be called to create active record objects after fetching data from the database. It is mainly used by yii\db\ActiveQuery to populate the query results into active records. When calling this method manually you should call afterFind() on the created record to trigger the afterFind Event. public static void populateRecord ( $record, $row

db\BaseActiveRecord optimisticLock()

optimisticLock() public method Returns the name of the column that stores the lock version for implementing optimistic locking. Optimistic locking allows multiple users to access the same record for edits and avoids potential conflicts. In case when a user attempts to save the record upon some staled data (because another user has modified the data), a yii\db\StaleObjectException exception will be thrown, and the update or deletion is skipped. Optimistic locking is only supported by update(

db\BaseActiveRecord offsetUnset()

offsetUnset() public method Sets the element value at the specified offset to null. This method is required by the SPL interface ArrayAccess. It is implicitly called when you use something like unset($model[$offset]). public void offsetUnset ( $offset )$offset mixed The offset to unset element