| 1 |
<?php |
| 2 |
|
| 3 |
namespace ipl\Orm\Contract; |
| 4 |
|
| 5 |
use ipl\Orm\ColumnDefinition; |
| 6 |
|
| 7 |
interface RewriteColumnBehavior extends RewriteFilterBehavior |
| 8 |
{ |
| 9 |
/** |
| 10 |
* Rewrite the given column |
| 11 |
* |
| 12 |
* The result must be returned otherwise (NULL is returned) the original column is kept as is. |
| 13 |
* |
| 14 |
* @param mixed $column |
| 15 |
* @param ?string $relation The absolute path of the model. For reference only, don't include it in the result |
| 16 |
* |
| 17 |
* @return mixed |
| 18 |
*/ |
| 19 |
public function rewriteColumn($column, ?string $relation = null); |
| 20 |
|
| 21 |
/** |
| 22 |
* Get whether {@see rewriteColumn} might return an otherwise unknown column or expression |
| 23 |
* |
| 24 |
* @param string $name |
| 25 |
* |
| 26 |
* @return bool |
| 27 |
*/ |
| 28 |
public function isSelectableColumn(string $name): bool; |
| 29 |
|
| 30 |
/** |
| 31 |
* Rewrite the given column definition |
| 32 |
* |
| 33 |
* @param ColumnDefinition $def |
| 34 |
* @param string $relation The absolute path of the model. For reference only, don't include it in the result |
| 35 |
* |
| 36 |
* @return void |
| 37 |
*/ |
| 38 |
public function rewriteColumnDefinition(ColumnDefinition $def, string $relation): void; |
| 39 |
} |