Class lispa\amos\chat\models\base\Conversation

Inheritancelispa\amos\chat\models\base\Conversation » lispa\amos\core\record\Record » yii\db\ActiveRecord » yii\db\BaseActiveRecord » yii\base\Model » yii\base\Component » yii\base\Object
ImplementsArrayAccess, IteratorAggregate, lispa\amos\core\interfaces\StatsToolbarInterface, yii\base\Arrayable, yii\base\Configurable, yii\db\ActiveRecordInterface
Uses Traitsyii\base\ArrayableTrait
Subclasseslispa\amos\chat\models\Conversation

Class Conversation

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$activeValidators yii\validators\Validator[] The validators applicable to the current $scenario. yii\base\Model
$attributes array Attribute values (name => value). yii\base\Model
$behaviors yii\base\Behavior[] List of behaviors attached to this component yii\base\Component
$createdUserProfile yii\db\ActiveQuery lispa\amos\core\record\Record
$deleteUrl lispa\amos\chat\models\base\Conversation
$deletedUserProfile yii\db\ActiveQuery lispa\amos\core\record\Record
$dirtyAttributes array The changed attribute values (name-value pairs) yii\db\BaseActiveRecord
$errors array Errors for all attributes or the specified attribute. yii\base\Model
$firstErrors array The first errors. yii\base\Model
$isNewRecord boolean Whether the record is new and should be inserted when calling save(). yii\db\BaseActiveRecord
$iterator ArrayIterator An iterator for traversing the items in the list. yii\base\Model
$lastMessage yii\db\ActiveQuery lispa\amos\chat\models\base\Conversation
$loadUrl lispa\amos\chat\models\base\Conversation
$modulesChainBehavior lispa\amos\core\record\Record
$newMessages yii\db\ActiveQuery lispa\amos\chat\models\base\Conversation
$oldAttributes array The old attribute values (name-value pairs) yii\db\BaseActiveRecord
$oldPrimaryKey mixed The old primary key value. yii\db\BaseActiveRecord
$orderAttribute string Selected ORDER attribute (field) from the ORDER form lispa\amos\core\record\Record
$orderAttributes array Array of order fields get from the config file of the module lispa\amos\core\record\Record
$orderAttributesLabels mixed lispa\amos\core\record\Record
$orderType integer ORDER ascending (SORT_ASC), descending (SORT_DESC) lispa\amos\core\record\Record
$orderVars lispa\amos\core\record\Record
$primaryKey mixed The primary key value. yii\db\BaseActiveRecord
$readUrl lispa\amos\chat\models\base\Conversation
$relatedRecords array An array of related records indexed by relation names. yii\db\BaseActiveRecord
$scenario string The scenario that this model is in. yii\base\Model
$sendUrl lispa\amos\chat\models\base\Conversation
$statsToolbar lispa\amos\core\record\Record
$tagsMandatory lispa\amos\core\record\Record
$unreadUrl lispa\amos\chat\models\base\Conversation
$updatedUserProfile yii\db\ActiveQuery lispa\amos\core\record\Record
$validatorUsersId array lispa\amos\core\record\Record
$validators ArrayObject|yii\validators\Validator[] All the validators declared in the model. yii\base\Model
$workflowStatusLabel string lispa\amos\core\record\Record

Protected Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$adminInstalled lispa\amos\core\record\Record

Public Methods

Hide inherited methods

MethodDescriptionDefined 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\Component
__construct() Constructor. yii\base\Object
__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
__toString() Representation of the record in string lispa\amos\chat\models\base\Conversation
__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
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. yii\db\BaseActiveRecord
afterRefresh() This method is called when the AR object is refreshed. yii\db\BaseActiveRecord
afterSave() Override Required for cache lispa\amos\core\record\Record
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() lispa\amos\core\record\Record
attributes() Returns the list of all attribute names of the model. lispa\amos\chat\models\base\Conversation
basicFind() Base query, it INCLUDE deleted elements lispa\amos\core\record\Record
beforeDelete() Override for demos lispa\amos\chat\models\base\Conversation
beforeSave() Override for demos lispa\amos\chat\models\base\Conversation
beforeValidate() This method is invoked before validation starts. lispa\amos\chat\models\base\Conversation
behaviors() lispa\amos\core\record\Record
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
canUseModuleOrder() Check if there is an order variable for the module lispa\amos\core\record\Record
className() Returns the fully qualified name of this class. yii\base\Object
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
detachBehavior() Detaches a behavior from the component. yii\base\Component
detachBehaviorByClassName() This method detach a behavior from the model. lispa\amos\core\record\Record
detachBehaviors() Detaches all behaviors from the component. yii\base\Component
detachBehaviorsOnWhiteList() lispa\amos\core\record\Record
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(). yii\base\ArrayableTrait
fields() Returns the list of fields that should be returned by default by toArray() when no specific fields are specified. yii\base\ArrayableTrait
find() lispa\amos\chat\models\base\Conversation
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
findBehaviorByClassName() This method find a behavior from the model. lispa\amos\core\record\Record
findBySql() Creates an yii\db\ActiveQuery instance with a given SQL statement. yii\db\ActiveRecord
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
get() lispa\amos\chat\models\base\Conversation
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
getCreatedUserProfile() lispa\amos\core\record\Record
getDb() Returns the database connection used by this AR class. yii\db\ActiveRecord
getDeleteUrl() lispa\amos\chat\models\base\Conversation
getDeletedUserProfile() lispa\amos\core\record\Record
getDirtyAttributes() Returns the attribute values that have been modified since they are loaded or saved most recently. yii\db\BaseActiveRecord
getErrors() Returns the errors for all attributes or a single attribute. yii\base\Model
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
getIsNewRecord() Returns a value indicating whether the current record is new. yii\db\BaseActiveRecord
getIterator() Returns an iterator for traversing the attributes in the model. yii\base\Model
getLastMessage() lispa\amos\chat\models\base\Conversation
getLoadUrl() lispa\amos\chat\models\base\Conversation
getNewMessages() lispa\amos\chat\models\base\Conversation
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
getOrderAttributesLabels() Array of fields => labels for the ORDER form see "_order.php" file lispa\amos\core\record\Record
getPrimaryKey() Returns the primary key value(s). yii\db\BaseActiveRecord
getReadUrl() lispa\amos\chat\models\base\Conversation
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
getSendUrl() lispa\amos\chat\models\base\Conversation
getStatsToolbar() lispa\amos\core\record\Record
getTableSchema() Returns the schema information of the DB table associated with this AR class. yii\db\ActiveRecord
getUnreadUrl() lispa\amos\chat\models\base\Conversation
getUpdatedUserProfile() lispa\amos\core\record\Record
getValidatorUsersId() Method return user ids of record validators lispa\amos\core\record\Record
getValidators() Returns all the validators declared in rules(). yii\base\Model
getWorkflowStatusLabel() This method return the correct workflow status label. It checks if the workflow behavior is present, then checks if the model has a workflow status and return the correct label. lispa\amos\core\record\Record
globalSearchTags() This method is called by search module to fetch results matching one or more tags lispa\amos\core\record\Record
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() Declares a has-many relation. yii\db\BaseActiveRecord
hasMethod() Returns a value indicating whether a method is defined. yii\base\Component
hasOne() Declares a has-one relation. yii\db\BaseActiveRecord
hasProperty() Returns a value indicating whether a property is defined for this component. yii\base\Component
init() lispa\amos\core\record\Record
initOrderVars() Init the order variables from the module config lispa\amos\core\record\Record
insert() Inserts a row into the associated database table using the attribute values of this record. yii\db\ActiveRecord
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
isDemo() Check is demo environment lispa\amos\core\record\Record
isEnabledCwh() lispa\amos\core\record\Record
isEnabledModule() lispa\amos\core\record\Record
isEnabledTag() lispa\amos\core\record\Record
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
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. lispa\amos\chat\models\base\Conversation
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
read() This method sets the "is_new" field at false of all current conversation messages. lispa\amos\chat\models\base\Conversation
recent() lispa\amos\chat\models\base\Conversation
refresh() Repopulates this active record with the latest data. yii\db\BaseActiveRecord
remove() lispa\amos\chat\models\base\Conversation
renameFormNamesAndIds() This method return an array of array. The array keys are all the model fields and the values are arrays with "name! and "id" keys modified with the string contained in the param. The return array structure is the following: $newNameAndIds = [ 'FIELD_NAME_1' => [ 'name' => 'NEW_NAME', 'id' => 'NEW_ID' ], . lispa\amos\core\record\Record
representingColumn() lispa\amos\core\record\Record
rules() lispa\amos\core\record\Record
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. lispa\amos\core\record\Record
setAttribute() Sets the named attribute value. yii\db\BaseActiveRecord
setAttributes() Sets the attribute values in a massive way. yii\base\Model
setIsNewRecord() Sets the value indicating whether the record is new. yii\db\BaseActiveRecord
setOldAttribute() Sets the old value of the named attribute. yii\db\BaseActiveRecord
setOldAttributes() Sets the old attribute values. yii\db\BaseActiveRecord
setOrderAttribute() Set order field lispa\amos\core\record\Record
setOrderAttributes() Set the list of fields order for this module lispa\amos\core\record\Record
setOrderType() Set order type: ascending (SORT_ASC), descending (SORT_DESC) lispa\amos\core\record\Record
setOrderVars() Identifies the sort fields lispa\amos\core\record\Record
setScenario() Sets the scenario for the model. yii\base\Model
tableName() Declares the name of the database table associated with this AR class. lispa\amos\chat\models\base\Conversation
toArray() Converts the model into an array. yii\base\ArrayableTrait
toStringWithCharLimit() lispa\amos\core\record\Record
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
unread() lispa\amos\chat\models\base\Conversation
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

Hide inherited methods

MethodDescriptionDefined By
__shortText() Parse string and return limited one lispa\amos\core\record\Record
baseQuery() lispa\amos\chat\models\base\Conversation
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
findByCondition() Finds ActiveRecord instance(s) by the given condition. yii\db\ActiveRecord
insertInternal() Inserts an ActiveRecord into DB without considering transaction. yii\db\ActiveRecord
resolveFields() Determines which fields can be returned by toArray(). yii\base\ArrayableTrait
updateInternal() yii\db\BaseActiveRecord

Events

Hide inherited events

EventTypeDescriptionDefined By
EVENT_AFTER_DELETE yii\base\Event An event that is triggered after a record is deleted. yii\db\BaseActiveRecord
EVENT_AFTER_FIND yii\base\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\base\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\base\Event An event that is triggered when the record is initialized via init(). yii\db\BaseActiveRecord

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
OP_ALL 7 All three operations: insert, update, delete. This is a shortcut of the expression: OP_INSERT | OP_UPDATE | OP_DELETE. yii\db\ActiveRecord
OP_DELETE 4 The delete operation. This is mainly used when overriding transactions() to specify which operations are transactional. yii\db\ActiveRecord
OP_INSERT 1 The insert operation. This is mainly used when overriding transactions() to specify which operations are transactional. yii\db\ActiveRecord
OP_UPDATE 2 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_FAKE_REQUIRED 'scenario_fake_required' lispa\amos\core\record\Record

Property Details

$deleteUrl public read-only property
public void getDeleteUrl ( )
$lastMessage public read-only property
$loadUrl public read-only property
public void getLoadUrl ( )
$newMessages public read-only property
$readUrl public read-only property
public void getReadUrl ( )
$sendUrl public read-only property
public void getSendUrl ( )
$unreadUrl public read-only property
public void getUnreadUrl ( )

Method Details

__toString() public method

Representation of the record in string

public string __toString ( )
attributes() public method

Returns the list of all attribute names of the model.

The default implementation will return all column names of the table associated with this AR class.

public array attributes ( )
return array

List of attribute names.

baseQuery() protected static method

protected static lispa\amos\chat\models\search\ConversationQuery baseQuery ( $userId )
$userId integer
beforeDelete() public method

Override for demos

public boolean beforeDelete ( )
beforeSave() public method

Override for demos

The default implementation will trigger an EVENT_BEFORE_INSERT event when $insert is true, or an EVENT_BEFORE_UPDATE event if $insert is false. When overriding this method, make sure you call the parent implementation like the following:

public function beforeSave($insert)
{
    if (!parent::beforeSave($insert)) {
        return false;
    }

    // ...custom code here...
    return true;
}
public boolean beforeSave ( $insert )
$insert boolean

Whether this method called while inserting a record. If false, it means the method is called while updating a record.

return boolean

Whether the insertion or updating should continue. If false, the insertion or updating will be cancelled.

beforeValidate() public method

This method is invoked before validation starts.

The default implementation raises a beforeValidate event. You may override this method to do preliminary checks before validation. Make sure the parent implementation is invoked so that the event can be raised.

public boolean beforeValidate ( )
return boolean

Whether the validation should be executed. Defaults to true. If false is returned, the validation will stop and the model is considered invalid.

find() public static method

public static object find ( )
throws yii\base\InvalidConfigException
get() public static method

public static lispa\amos\chat\DataProvider get ( $userId, $limit, $history true, $key null )
$userId
$limit
$history boolean
$key null
getDeleteUrl() public method

public void getDeleteUrl ( )
getLastMessage() public method

public yii\db\ActiveQuery getLastMessage ( )
getLoadUrl() public method

public void getLoadUrl ( )
getNewMessages() public method

public yii\db\ActiveQuery getNewMessages ( )
getReadUrl() public method

public void getReadUrl ( )
getSendUrl() public method

public void getSendUrl ( )
getUnreadUrl() public method

public void getUnreadUrl ( )
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 \lispa\amos\chat\models\base\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 )
$record yii\db\BaseActiveRecord

The record to be populated. In most cases this will be an instance created by instantiate() beforehand.

$row array

Attribute values (name => value)

read() public static method

This method sets the "is_new" field at false of all current conversation messages.

public static array read ( $userId, $contactId )
$userId integer

ID of the logged user

$contactId integer

ID of the contact that we are texting to

return array

The number of rows updated

recent() public static method

public static array|null|yii\db\ActiveRecord recent ( $userId )
$userId
remove() public static method

public static array remove ( $userId, $contactId )
$userId string
$contactId string
return array

The number of rows updated

tableName() public static method

Declares the name of the database table associated with this AR class.

By default this method returns the class name as the table name by calling \lispa\amos\chat\models\base\Inflector::camel2id() with prefix \lispa\amos\chat\models\base\Connection::tablePrefix. For example if \lispa\amos\chat\models\base\Connection::tablePrefix is tbl_, Customer becomes tbl_customer, and OrderItem becomes tbl_order_item. You may override this method if the table is not named after this convention.

public static string tableName ( )
return string

The table name

unread() public static method

public static array unread ( $userId, $contactId )
$userId
$contactId