1 | <?php |
||
32 | abstract class Relationship |
||
33 | { |
||
34 | /** |
||
35 | * Constant for the belongs-to or one-to many relation ship. |
||
36 | */ |
||
37 | const BELONGS_TO = 'BelongsTo'; |
||
38 | |||
39 | const HAS_MANY = 'HasMany'; |
||
40 | const MANY_HAVE_MANY = 'ManyHaveMany'; |
||
41 | |||
42 | protected $options = []; |
||
43 | protected $type; |
||
44 | protected $setupName; |
||
45 | protected $setupTable; |
||
46 | protected $setupSchema; |
||
47 | protected $setupPrimaryKey; |
||
48 | |||
49 | private $setup = false; |
||
50 | private $query; |
||
51 | protected $queryPrepared = false; |
||
52 | |||
53 | 28 | public function setOptions($options) |
|
57 | |||
58 | 12 | public function getQuery() |
|
66 | |||
67 | public function getOptions() |
||
71 | |||
72 | /** |
||
73 | * Gets an instance of the related model accessed through this class. |
||
74 | * |
||
75 | * @return RecordWrapper |
||
76 | */ |
||
77 | 12 | public function getModelInstance() |
|
86 | |||
87 | 28 | public function setup($name, $schema, $table, $primaryKey) |
|
94 | |||
95 | public function preSave(&$wrapper, $value) |
||
98 | |||
99 | public function postSave(&$wrapper) |
||
102 | |||
103 | abstract public function prepareQuery($data); |
||
104 | |||
105 | abstract public function runSetup(); |
||
106 | } |
||
107 |
Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a
@return
annotation as described here.