From 896ce2880f23726deec066c494e3fdb1210e1e26 Mon Sep 17 00:00:00 2001 From: Rotimi Ade Date: Fri, 23 Dec 2022 12:20:10 -0700 Subject: [PATCH] Testing in progress --- src/GDAO/Model/RecordInterface.php | 51 +++--------------------------- 1 file changed, 5 insertions(+), 46 deletions(-) diff --git a/src/GDAO/Model/RecordInterface.php b/src/GDAO/Model/RecordInterface.php index 462630f..c978784 100644 --- a/src/GDAO/Model/RecordInterface.php +++ b/src/GDAO/Model/RecordInterface.php @@ -71,7 +71,6 @@ interface RecordInterface extends \ArrayAccess, \Countable, \IteratorAggregate //////////////////////////////////////////////////////////////////////////// /** - * * @param array $data associative array of data to be loaded into this record. * [ * 'col_name1'=>'value_for_col1', @@ -84,7 +83,6 @@ interface RecordInterface extends \ArrayAccess, \Countable, \IteratorAggregate public function __construct(array $data, \GDAO\Model $model); /** - * * Delete the record from the db. * * If deletion was successful and the primary key column for the record's db @@ -97,12 +95,10 @@ public function __construct(array $data, \GDAO\Model $model); * @param bool $set_record_objects_data_to_empty_array true to reset the record object's data to an empty array if db deletion was successful, false to keep record object's data * * @return bool true if record was successfully deleted from db or false if not - * */ public function delete($set_record_objects_data_to_empty_array=false): bool; /** - * * Get the data for this record. * Modifying the returned data will not affect the data inside this record. * @@ -111,17 +107,15 @@ public function delete($set_record_objects_data_to_empty_array=false): bool; public function getData(): array; /** - * * Get a copy of the initial data loaded into this record. * Modifying the returned data will not affect the initial data inside this record. * - * @return null|array a copy of the initial data loaded into this record. + * @return array a copy of the initial data loaded into this record. */ - public function getInitialData(): ?array; + public function getInitialData(): array; /** - * * Get all the related data loaded into this record. * Modifying the returned data will not affect the related data inside this record. * @@ -130,7 +124,6 @@ public function getInitialData(): ?array; public function getRelatedData(): array; /** - * * Get data for this record that does not belong to any of it's table columns and is not related data. * * @return array Data for this record (not to be saved to the db i.e. not from any actual db column and not related data). @@ -138,7 +131,6 @@ public function getRelatedData(): array; public function getNonTableColAndNonRelatedData(): array; /** - * * Get a reference to the data for this record. * Modifying the returned data will affect the data inside this record. * @@ -147,16 +139,14 @@ public function getNonTableColAndNonRelatedData(): array; public function &getDataByRef(): array; /** - * * Get a reference to the initial data loaded into this record. * Modifying the returned data will affect the initial data inside this record. * - * @return null|array a reference to the initial data loaded into this record. + * @return array a reference to the initial data loaded into this record. */ - public function &getInitialDataByRef(): ?array; + public function &getInitialDataByRef(): array; /** - * * Get a reference to all the related data loaded into this record. * Modifying the returned data will affect the related data inside this record. * @@ -165,7 +155,6 @@ public function &getInitialDataByRef(): ?array; public function &getRelatedDataByRef(): array; /** - * * Get data for this record that does not belong to any of it's table columns and is not related data. * * @return array reference to the data for this record (not from any actual db column and not related data). @@ -173,7 +162,6 @@ public function &getRelatedDataByRef(): array; public function &getNonTableColAndNonRelatedDataByRef(): array; /** - * * Set relation data for this record. * * @param string $key relation name @@ -186,26 +174,21 @@ public function &getNonTableColAndNonRelatedDataByRef(): array; public function setRelatedData($key, $value): self; /** - * - * Get the model object that saves and reads data to and from the db on - * behalf of this record + * Get the model object that saves and reads data to and from the db on behalf of this record */ public function getModel(): \GDAO\Model; /** - * * @return string name of the primary-key column of the db table this record belongs to */ public function getPrimaryCol(): string; /** - * * @return mixed the value stored in the primary-key column for this record. */ public function getPrimaryVal(); /** - * * Tells if the record, or a particular table-column in the record, has * changed from its initial value. * @@ -213,19 +196,15 @@ public function getPrimaryVal(); * * @return null|bool Returns null if the table-column name does not exist, * boolean true if the data is changed, boolean false if not changed. - * */ public function isChanged($col = null): ?bool; /** - * * Is the record new? (I.e. its data has never been saved to the db) - * */ public function isNew(): bool; /** - * * This method partially or completely overwrites pre-existing data for a * record and replaces it with the new data (this does not include related * data). If no data has previously been loaded into the record, keep a copy @@ -251,7 +230,6 @@ public function isNew(): bool; public function loadData($data_2_load, array $cols_2_load = []): self; /** - * * Set the _is_new attribute of this record to true (meaning that the data * for this record has never been saved to the db). * @@ -260,7 +238,6 @@ public function loadData($data_2_load, array $cols_2_load = []): self; public function markAsNew(): self; /** - * * Set the _is_new attribute of this record to false (meaning that the data * for this record has been saved to the db or was read from the db). * @@ -288,7 +265,6 @@ public function markAsNotNew(): self; public function setStateToNew(): self; /** - * * Save the specified or already existing data for this record to the db. * Since this record can only talk to the db via its model property (_model) * the save operation will actually be done via $this->model. @@ -296,12 +272,10 @@ public function setStateToNew(): self; * @param \GDAO\Model\RecordInterface|array $data_2_save * * @return null|bool true: successful save, false: failed save, null: no changed data to save - * */ public function save($data_2_save = null): ?bool; /** - * * Save the specified or already existing data for this record to the db. * Since this record can only talk to the db via its model property (_model) * the save operation will actually be done via $this->model. @@ -314,82 +288,67 @@ public function save($data_2_save = null): ?bool; * @param \GDAO\Model\RecordInterface|array $data_2_save * * @return bool|null true for a successful save, false for failed save, null: no changed data to save - * */ public function saveInTransaction($data_2_save = null): ?bool; /** - * * Set the \GDAO\Model object for this record * * @param \GDAO\Model $model - * * @return $this */ public function setModel(\GDAO\Model $model): self; /** - * * Get all the data and property (name & value pairs) for this record. * * @return array of all data & property (name & value pairs) for this record. - * */ public function toArray(): array; //Magic Methods /** - * * Gets a data value. * * @param string $key The requested data key. * * @return mixed The data value. - * */ public function __get($key); /** - * * Does a certain key exist in the data? * * Note that this is slightly different from normal PHP isset(); it will * say the key is set, even if the key value is null or otherwise empty. * * @param string $key The requested data key. - * */ public function __isset($key): bool; /** - * * Sets a key value. * * @param string $key The requested data key. * * @param mixed $val The value to set the data to. - * */ public function __set($key, $val): void; /** - * * Get the string representation of all the data and property * (name & value pairs) for this record. * * @return string string representation of all the data & property * (name & value pairs) for this record. - * */ public function __toString(): string; /** - * * Removes a key and its value in the data. * * @param string $key The requested data key. - * */ public function __unset($key): void; }