Major upgrade #3
@ -15,9 +15,9 @@ abstract Model #Orange {
|
|||||||
# Table $table
|
# Table $table
|
||||||
+ __construct(Table $table)
|
+ __construct(Table $table)
|
||||||
+ {abstract} value(mixed $value, string $field, ...) : mixed
|
+ {abstract} value(mixed $value, string $field, ...) : mixed
|
||||||
+ item(object $item, ?string $table = null) : ?object
|
+ item(?object $item, ?string $table = null) : ?object
|
||||||
+ items(?array $items = null, ?string $table = null) : ?array
|
+ items(?array $items = null, ?string $table = null) : ?array
|
||||||
+ row(array $item, ?string $table = null) : ?array
|
+ row(?array $item, ?string $table = null) : ?array
|
||||||
+ rows(?array $items = null, ?string $table = null) : ?array
|
+ rows(?array $items = null, ?string $table = null) : ?array
|
||||||
+ last(?string $table = null) : ?int
|
+ last(?string $table = null) : ?int
|
||||||
# getTableFields(string $table, bool $default = false) : ?array
|
# getTableFields(string $table, bool $default = false) : ?array
|
||||||
|
@ -69,14 +69,20 @@ abstract class Model
|
|||||||
* Model the values of an item
|
* Model the values of an item
|
||||||
* Example: $this->item(Object, 'table_name');
|
* Example: $this->item(Object, 'table_name');
|
||||||
*
|
*
|
||||||
* @param object $item The item object
|
* @param object|null $item The item object
|
||||||
* @param string|null $table The table
|
* @param string|null $table The table
|
||||||
*
|
*
|
||||||
* @return object|null
|
* @return object|null
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function item(object $item, ?string $table = null): ?object
|
public function item(?object $item, ?string $table = null): ?object
|
||||||
{
|
{
|
||||||
|
// we must have an object
|
||||||
|
if (empty($item))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// set the table name
|
// set the table name
|
||||||
if (empty($table))
|
if (empty($table))
|
||||||
{
|
{
|
||||||
@ -172,14 +178,20 @@ abstract class Model
|
|||||||
* Model the values of an row
|
* Model the values of an row
|
||||||
* Example: $this->item(Array, 'table_name');
|
* Example: $this->item(Array, 'table_name');
|
||||||
*
|
*
|
||||||
* @param array $item The item array
|
* @param array|null $item The item array
|
||||||
* @param string|null $table The table
|
* @param string|null $table The table
|
||||||
*
|
*
|
||||||
* @return array|null
|
* @return array|null
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function row(array $item, ?string $table = null): ?array
|
public function row(?array $item, ?string $table = null): ?array
|
||||||
{
|
{
|
||||||
|
// we must have an array
|
||||||
|
if (empty($item))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// set the table name
|
// set the table name
|
||||||
if (empty($table))
|
if (empty($table))
|
||||||
{
|
{
|
||||||
|
@ -43,14 +43,20 @@
|
|||||||
* Model the values of an item
|
* Model the values of an item
|
||||||
* Example: $this->item(Object, 'table_name');
|
* Example: $this->item(Object, 'table_name');
|
||||||
*
|
*
|
||||||
* @param object $item The item object
|
* @param object|null $item The item object
|
||||||
* @param string|null $table The table
|
* @param string|null $table The table
|
||||||
*
|
*
|
||||||
* @return object|null
|
* @return object|null
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function item(object $item, ?string $table = null): ?object
|
public function item(?object $item, ?string $table = null): ?object
|
||||||
{
|
{
|
||||||
|
// we must have an object
|
||||||
|
if (empty($item))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// set the table name
|
// set the table name
|
||||||
if (empty($table))
|
if (empty($table))
|
||||||
{
|
{
|
||||||
@ -146,14 +152,20 @@
|
|||||||
* Model the values of an row
|
* Model the values of an row
|
||||||
* Example: $this->item(Array, 'table_name');
|
* Example: $this->item(Array, 'table_name');
|
||||||
*
|
*
|
||||||
* @param array $item The item array
|
* @param array|null $item The item array
|
||||||
* @param string|null $table The table
|
* @param string|null $table The table
|
||||||
*
|
*
|
||||||
* @return array|null
|
* @return array|null
|
||||||
* @since 3.2.0
|
* @since 3.2.0
|
||||||
*/
|
*/
|
||||||
public function row(array $item, ?string $table = null): ?array
|
public function row(?array $item, ?string $table = null): ?array
|
||||||
{
|
{
|
||||||
|
// we must have an array
|
||||||
|
if (empty($item))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
// set the table name
|
// set the table name
|
||||||
if (empty($table))
|
if (empty($table))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user