1212use ActiveCollab \ContainerAccess \ContainerAccessInterface \Implementation as ContainerAccessInterfaceImplementation ;
1313use ActiveCollab \DatabaseConnection \ConnectionInterface ;
1414use ActiveCollab \DatabaseConnection \Record \ValueCasterInterface ;
15- use ActiveCollab \DatabaseObject \Exception \ValidationException ;
1615use ActiveCollab \DatabaseObject \PoolInterface ;
1716use ActiveCollab \DatabaseObject \Validator ;
1817use ActiveCollab \DatabaseObject \ValidatorInterface ;
@@ -36,48 +35,43 @@ abstract class Entity implements EntityInterface, ContainerAccessInterface
3635
3736 /**
3837 * Name of the table.
39- *
40- * @var string
4138 */
42- protected $ table_name ;
39+ protected string $ table_name = '' ;
4340
4441 /**
4542 * Primary key fields.
46- *
47- * @var array
4843 */
49- protected $ primary_key = 'id ' ;
44+ protected string $ primary_key = 'id ' ;
5045
5146 /**
5247 * Name of autoincrement field (if exists).
53- *
54- * @var string
5548 */
56- protected $ auto_increment = 'id ' ;
49+ protected string $ auto_increment = 'id ' ;
5750
5851 /**
5952 * @var string[]
6053 */
61- protected $ order_by = ['id ' ];
54+ protected array $ order_by = ['id ' ];
6255
6356 /**
6457 * Table fields that are managed by this entity.
6558 */
66- protected $ entity_fields = [];
59+ protected array $ entity_fields = [];
60+
61+ /**
62+ * Table fields prepared for SELECT SQL query.
63+ */
64+ protected array $ sql_read_statements = [];
6765
6866 /**
6967 * Generated fields that are loaded, but not managed by the entity.
70- *
71- * @var array
7268 */
73- protected $ generated_entity_fields = [];
69+ protected array $ generated_entity_fields = [];
7470
7571 /**
7672 * List of default field values.
77- *
78- * @var array
7973 */
80- protected $ default_entity_field_values = [];
74+ protected array $ default_entity_field_values = [];
8175
8276 public function __construct (
8377 protected ConnectionInterface $ connection ,
@@ -218,14 +212,11 @@ private function areFieldValuesSame($value_1, $value_2)
218212 }
219213 }
220214
221- /**
222- * {@inheritdoc}
223- */
224- public function getPrimaryKey ()
215+ public function getPrimaryKey (): string
225216 {
226217 return $ this ->primary_key ;
227218 }
228-
219+
229220 public function getTableName (): string
230221 {
231222 return $ this ->table_name ;
@@ -240,8 +231,7 @@ public function getTableName(): string
240231 *
241232 * If $cache_row is set to true row data will be added to cache
242233 *
243- * @param array $row
244- * @throws InvalidArgumentException
234+ * @param array $row
245235 */
246236 public function loadFromRow (array $ row )
247237 {
@@ -284,7 +274,6 @@ public function loadFromRow(array $row)
284274 * Save object into database (insert or update).
285275 *
286276 * @return $this
287- * @throws ValidationException
288277 */
289278 public function &save ()
290279 {
@@ -725,10 +714,9 @@ public function getOldFieldValue($field)
725714 * runs fine - modifications are saved, in case of primary key old value
726715 * will be remembered in case we need to update the row and so on
727716 *
728- * @param string $field
729- * @param mixed $value
717+ * @param string $field
718+ * @param mixed $value
730719 * @return $this
731- * @throws InvalidArgumentException
732720 */
733721 public function &setFieldValue ($ field , $ value )
734722 {
0 commit comments