| 1 | <?php |
||
| 21 | trait ModifiedColumnEntityTrait |
||
| 22 | { |
||
| 23 | private $modified_columns = []; |
||
| 24 | |||
| 25 | abstract function touch(); |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @return array |
||
| 29 | */ |
||
| 30 | public function getModifiedColumns() |
||
| 34 | |||
| 35 | /** |
||
| 36 | * @param $column |
||
| 37 | * @return FlexibleEntityInterface |
||
| 38 | */ |
||
| 39 | public function addModifiedColumn($column) |
||
| 40 | { |
||
| 41 | if (!in_array($column, $this->modified_columns)) { |
||
| 42 | $this->modified_columns[] = $column; |
||
| 43 | } |
||
| 44 | |||
| 45 | $this->touch(); |
||
| 46 | |||
| 47 | return $this; |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @param $column |
||
| 52 | * @return FlexibleEntityInterface |
||
| 53 | */ |
||
| 54 | public function removeModifiedColumn($column) |
||
| 66 | } |
||
| 67 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.