Trait Yiisoft\ActiveRecord\Trait\CustomTableNameTrait
Trait to implement a custom table name for ActiveRecord.
See also \Yiisoft\ActiveRecord\Trait\ActiveRecordInterface::tableName().
Public Methods
| Method | Description | Defined By |
|---|---|---|
| tableName() | Yiisoft\ActiveRecord\Trait\CustomTableNameTrait | |
| withTableName() | Sets the table name for the ActiveRecord. | Yiisoft\ActiveRecord\Trait\CustomTableNameTrait |
Method Details
| public tableName( ): string |
public function tableName(): string
{
return $this->tableName ??= parent::tableName();
}
Sets the table name for the ActiveRecord.
| public withTableName( string $tableName ): Yiisoft\ActiveRecord\Trait\CustomTableNameTrait | ||
| $tableName | string | |
public function withTableName(string $tableName): static
{
$new = clone $this;
$new->tableName = $tableName;
return $new;
}
Signup or Login in order to comment.