12
12
* the future.
13
13
*
14
14
* @author Rotimi Adegbamigbe
15
- * @copyright (c) 2022 , Rotexsoft
15
+ * @copyright (c) 2023 , Rotexsoft
16
16
*/
17
17
abstract class Model {
18
18
@@ -604,22 +604,22 @@ abstract class Model {
604
604
/**
605
605
* @var string
606
606
*/
607
- public const RELATION_TYPE_HAS_ONE = 'rt_ho ' ;
607
+ final public const RELATION_TYPE_HAS_ONE = 'rt_ho ' ;
608
608
609
609
/**
610
610
* @var string
611
611
*/
612
- public const RELATION_TYPE_HAS_MANY = 'rt_hm ' ;
612
+ final public const RELATION_TYPE_HAS_MANY = 'rt_hm ' ;
613
613
614
614
/**
615
615
* @var string
616
616
*/
617
- public const RELATION_TYPE_BELONGS_TO = 'rt_bt ' ;
617
+ final public const RELATION_TYPE_BELONGS_TO = 'rt_bt ' ;
618
618
619
619
/**
620
620
* @var string
621
621
*/
622
- public const RELATION_TYPE_HAS_MANY_THROUGH = 'rt_hmt ' ;
622
+ final public const RELATION_TYPE_HAS_MANY_THROUGH = 'rt_hmt ' ;
623
623
624
624
/**
625
625
* A PDO compliant Data Source Name (DSN) string containing the information
@@ -1467,7 +1467,7 @@ public abstract function fetchPairs(?object $query = null): array;
1467
1467
*
1468
1468
* @throws \PDOException
1469
1469
*/
1470
- public abstract function fetchValue (?object $ query = null );
1470
+ public abstract function fetchValue (?object $ query = null ): mixed ;
1471
1471
1472
1472
/**
1473
1473
* Return the PDO object powering this model or throw
@@ -1511,7 +1511,7 @@ public abstract function getPDO(): \PDO;
1511
1511
* @throws \GDAO\ModelInvalidInsertValueSuppliedException
1512
1512
* @throws \GDAO\ModelPrimaryColValueNotRetrievableAfterInsertException
1513
1513
*/
1514
- public abstract function insert (array $ data_2_insert = []);
1514
+ public abstract function insert (array $ data_2_insert = []): bool | array ;
1515
1515
1516
1516
/**
1517
1517
* Insert one or more rows to the model table with the specified values.
@@ -1604,7 +1604,7 @@ public abstract function insertMany(array $rows_of_data_2_insert = []): bool;
1604
1604
public abstract function updateMatchingDbTableRows (
1605
1605
array $ col_names_n_values_2_save = [],
1606
1606
array $ col_names_n_values_2_match = []
1607
- ):self ;
1607
+ ): static ;
1608
1608
1609
1609
/**
1610
1610
* Update the specified record in the database.
@@ -1617,7 +1617,7 @@ public abstract function updateMatchingDbTableRows(
1617
1617
*
1618
1618
* @throws \PDOException
1619
1619
*/
1620
- public abstract function updateSpecifiedRecord (\GDAO \Model \RecordInterface $ record ): self ;
1620
+ public abstract function updateSpecifiedRecord (\GDAO \Model \RecordInterface $ record ): static ;
1621
1621
1622
1622
//////////////////////////////////////
1623
1623
// Getters for non-public properties
@@ -1763,13 +1763,13 @@ public function getUsername(): string {
1763
1763
return $ this ->username ;
1764
1764
}
1765
1765
1766
- public function setCollectionClassName (?string $ collection_class_name ): self {
1766
+ public function setCollectionClassName (?string $ collection_class_name ): static {
1767
1767
1768
1768
$ this ->collection_class_name = $ collection_class_name ;
1769
1769
return $ this ;
1770
1770
}
1771
1771
1772
- public function setCreatedTimestampColumnName (?string $ created_timestamp_column_name ): self {
1772
+ public function setCreatedTimestampColumnName (?string $ created_timestamp_column_name ): static {
1773
1773
1774
1774
$ this ->created_timestamp_column_name = $ created_timestamp_column_name ;
1775
1775
return $ this ;
@@ -1781,7 +1781,7 @@ public function setCreatedTimestampColumnName(?string $created_timestamp_column_
1781
1781
* that can be used for connecting to the DB then setting this property would make
1782
1782
* sense.
1783
1783
*/
1784
- public function setDsn (string $ dsn ): self {
1784
+ public function setDsn (string $ dsn ): static {
1785
1785
1786
1786
$ this ->dsn = $ dsn ;
1787
1787
return $ this ;
@@ -1793,7 +1793,7 @@ public function setDsn(string $dsn): self {
1793
1793
* that can be used for connecting to the DB then setting this property would make
1794
1794
* sense.
1795
1795
*/
1796
- public function setPasswd (string $ passwd ): self {
1796
+ public function setPasswd (string $ passwd ): static {
1797
1797
1798
1798
$ this ->passwd = $ passwd ;
1799
1799
return $ this ;
@@ -1802,19 +1802,19 @@ public function setPasswd(string $passwd): self {
1802
1802
/**
1803
1803
* @param mixed[] $pdo_driver_opts
1804
1804
*/
1805
- public function setPdoDriverOpts (array $ pdo_driver_opts ): self {
1805
+ public function setPdoDriverOpts (array $ pdo_driver_opts ): static {
1806
1806
1807
1807
$ this ->pdo_driver_opts = $ pdo_driver_opts ;
1808
1808
return $ this ;
1809
1809
}
1810
1810
1811
- public function setPrimaryCol (string $ primary_col ): self {
1811
+ public function setPrimaryCol (string $ primary_col ): static {
1812
1812
1813
1813
$ this ->primary_col = $ primary_col ;
1814
1814
return $ this ;
1815
1815
}
1816
1816
1817
- public function setRecordClassName (?string $ record_class_name ): self {
1817
+ public function setRecordClassName (?string $ record_class_name ): static {
1818
1818
1819
1819
$ this ->record_class_name = $ record_class_name ;
1820
1820
return $ this ;
@@ -1823,7 +1823,7 @@ public function setRecordClassName(?string $record_class_name): self {
1823
1823
/**
1824
1824
* @param mixed[] $relations
1825
1825
*/
1826
- public function setRelations (array $ relations ): self {
1826
+ public function setRelations (array $ relations ): static {
1827
1827
1828
1828
$ this ->relations = $ relations ;
1829
1829
return $ this ;
@@ -1832,19 +1832,19 @@ public function setRelations(array $relations): self {
1832
1832
/**
1833
1833
* @param mixed[] $table_cols
1834
1834
*/
1835
- public function setTableCols (array $ table_cols ): self {
1835
+ public function setTableCols (array $ table_cols ): static {
1836
1836
1837
1837
$ this ->table_cols = $ table_cols ;
1838
1838
return $ this ;
1839
1839
}
1840
1840
1841
- public function setTableName (string $ table_name ): self {
1841
+ public function setTableName (string $ table_name ): static {
1842
1842
1843
1843
$ this ->table_name = $ table_name ;
1844
1844
return $ this ;
1845
1845
}
1846
1846
1847
- public function setUpdatedTimestampColumnName (?string $ updated_timestamp_column_name ): self {
1847
+ public function setUpdatedTimestampColumnName (?string $ updated_timestamp_column_name ): static {
1848
1848
1849
1849
$ this ->updated_timestamp_column_name = $ updated_timestamp_column_name ;
1850
1850
return $ this ;
@@ -1856,7 +1856,7 @@ public function setUpdatedTimestampColumnName(?string $updated_timestamp_column_
1856
1856
* that can be used for connecting to the DB then setting this property would make
1857
1857
* sense.
1858
1858
*/
1859
- public function setUsername (string $ username ): self {
1859
+ public function setUsername (string $ username ): static {
1860
1860
1861
1861
$ this ->username = $ username ;
1862
1862
return $ this ;
0 commit comments