Trait Yiisoft\ActiveRecord\Trait\CustomTableNameTrait
Trait to implement a custom table name for ActiveRecord.
See also \
Public Methods
| Method | Description | Defined By |
|---|---|---|
| tableName() | Yiisoft\ |
|
| withTableName() | Sets the table name for the ActiveRecord. | Yiisoft\ |
Method Details
| public string tableName ( ) |
public function tableName(): string
{
return $this->tableName ??= parent::tableName();
}
Sets the table name for the ActiveRecord.
| public static withTableName ( string $tableName ) | ||
| $tableName | string | |
public function withTableName(string $tableName): static
{
$new = clone $this;
$new->tableName = $tableName;
return $new;
}
User Contributed Notes
Leave a comment
Join the conversation to share a note.