indexName() public static method

By default this method returns the class name as the index name by calling [[Inflector::camel2id()]]. For example, 'Article' becomes 'article', and 'StockItem' becomes 'stock_item'. You may override this method if the index is not named after this convention.
public static indexName ( ) : string
return string the index name
Example #1
0
 /**
  * Returns a value indicating whether the given active record is the same as the current one.
  * The comparison is made by comparing the index names and the primary key values of the two active records.
  * If one of the records [[isNewRecord|is new]] they are also considered not equal.
  * @param ActiveRecord $record record to compare to
  * @return boolean whether the two active records refer to the same row in the same index.
  */
 public function equals($record)
 {
     if ($this->isNewRecord || $record->isNewRecord) {
         return false;
     }
     return $this->indexName() === $record->indexName() && $this->getPrimaryKey() === $record->getPrimaryKey();
 }