1 | <?php |
||
13 | class Field implements FieldInterface |
||
14 | { |
||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $uniqueName; |
||
19 | |||
20 | /** |
||
21 | * @var string |
||
22 | */ |
||
23 | protected $readableName; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | protected $description; |
||
29 | |||
30 | /** |
||
31 | * @var \Netdudes\DataSourceryBundle\DataType\DataTypeInterface |
||
32 | */ |
||
33 | protected $dataType; |
||
34 | |||
35 | /** |
||
36 | * Arbitrary metadata to be passed around for the front-end |
||
37 | * when this instance is JSON-serialized. |
||
38 | * |
||
39 | * @var array |
||
40 | */ |
||
41 | protected $metaData; |
||
42 | |||
43 | /** |
||
44 | * Returns, if it applies, an array of possible choices for this DataSourceField. This allows for |
||
45 | * complex UXs to be implemented, such as intelligent predictions and autocompletes. |
||
46 | * |
||
47 | * @var null|mixed[] |
||
48 | */ |
||
49 | protected $choices = null; |
||
50 | |||
51 | /** |
||
52 | * @var string |
||
53 | */ |
||
54 | private $databaseFilterQueryField; |
||
55 | |||
56 | /** |
||
57 | * @var string|string[] |
||
58 | */ |
||
59 | private $databaseSelectAlias; |
||
60 | |||
61 | /** |
||
62 | * @param $uniqueName |
||
63 | * @param $readableName |
||
64 | * @param $description |
||
65 | * @param DataTypeInterface $dataType |
||
66 | * @param $databaseFilterQueryField |
||
67 | * @param null $databaseSelectAlias |
||
68 | * @param array $choices |
||
69 | */ |
||
70 | public function __construct( |
||
90 | |||
91 | /** |
||
92 | * @return string |
||
93 | */ |
||
94 | public function getUniqueName() |
||
98 | |||
99 | /** |
||
100 | * @return string |
||
101 | */ |
||
102 | public function getReadableName() |
||
106 | |||
107 | /** |
||
108 | * @return mixed[]|null |
||
109 | */ |
||
110 | public function getChoices() |
||
114 | |||
115 | /** |
||
116 | * @return DataTypeInterface |
||
117 | */ |
||
118 | public function getDataType() |
||
122 | |||
123 | /** |
||
124 | * @return string |
||
125 | */ |
||
126 | public function getDescription() |
||
130 | |||
131 | /** |
||
132 | * (PHP 5 >= 5.4.0)<br/> |
||
133 | * Specify data which should be serialized to JSON |
||
134 | * |
||
135 | * @link http://php.net/manual/en/jsonserializable.jsonserialize.php |
||
136 | * @return mixed data which can be serialized by <b>json_encode</b>, |
||
137 | * which is a value of any type other than a resource. |
||
138 | */ |
||
139 | public function jsonSerialize() |
||
155 | |||
156 | /** |
||
157 | * @return array |
||
158 | */ |
||
159 | public function getMetaData() |
||
163 | |||
164 | /** |
||
165 | * @param array $metaData |
||
166 | */ |
||
167 | public function setMetaData($metaData) |
||
171 | |||
172 | /** |
||
173 | * Returns the string alias or array combination of aliases to retrieve the data from the database |
||
174 | * |
||
175 | * @return string|string[] |
||
176 | */ |
||
177 | public function getDatabaseSelectAlias() |
||
181 | |||
182 | /** |
||
183 | * Returns the database query field used for filtering and searching |
||
184 | * |
||
185 | * @return string |
||
186 | */ |
||
187 | public function getDatabaseFilterQueryField() |
||
191 | } |
||
192 |