| 1 | <?php |
||
| 13 | trait AdminPdfLetterFieldsControllerTrait |
||
| 14 | { |
||
| 15 | use AbstractControllerTrait; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * @var PdfLetterTrait |
||
| 19 | */ |
||
| 20 | protected $pdfLetter; |
||
| 21 | |||
| 22 | /** |
||
| 23 | * @var Record |
||
| 24 | */ |
||
| 25 | protected $parent; |
||
| 26 | |||
| 27 | /** |
||
| 28 | * @return PdfLetterTrait |
||
|
|
|||
| 29 | */ |
||
| 30 | public function addNewModel() |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Called before action |
||
| 48 | */ |
||
| 49 | protected function parseRequestPdfLetterField() |
||
| 63 | |||
| 64 | /** |
||
| 65 | * @param bool $key |
||
| 66 | * @return FieldTrait|Record |
||
| 67 | */ |
||
| 68 | abstract protected function getModelFromRequest($key = false); |
||
| 69 | |||
| 70 | /** |
||
| 71 | * @param $name |
||
| 72 | * @param bool $key |
||
| 73 | * @return mixed |
||
| 74 | */ |
||
| 75 | abstract protected function checkForeignModelFromRequest($name, $key = false); |
||
| 76 | } |
In PHP traits cannot be used for type-hinting as they do not define a well-defined structure. This is because any class that uses a trait can rename that trait’s methods.
If you would like to return an object that has a guaranteed set of methods, you could create a companion interface that lists these methods explicitly.