yii\db\ActiveRecord::tableName PHP Method

tableName() public static method

By default this method returns the class name as the table name by calling [[Inflector::camel2id()]] with prefix [[Connection::tablePrefix]]. For example if [[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 tableName ( ) : string
return string the table name
    public static function tableName()
    {
        return '{{%' . Inflector::camel2id(StringHelper::basename(get_called_class()), '_') . '}}';
    }

Usage Example

 public function setInsertSort()
 {
     if (!$this->owner->{$this->attributeName}) {
         $query = $this->getQuery();
         $query->select(new Expression('MAX(' . $this->attributeName . ')'));
         $query->from($this->owner->tableName());
         $this->owner->{$this->attributeName} = $query->scalar() + 1;
     }
 }
All Usage Examples Of yii\db\ActiveRecord::tableName