Ubiquity 2.5.2
php rapid development framework
Loading...
Searching...
No Matches
CRUDDatas.php
Go to the documentation of this file.
1<?php
2
4
7
17class CRUDDatas {
18
19 protected $controller;
20
21 public function __construct($controller) {
22 $this->controller = $controller;
23 }
24
28 public function getTableNames():array {
29 return DAO::$db->getTablesName ();
30 }
31
38 public function getFieldNames(string $model): array {
39 return OrmUtils::getSerializableMembers ( $model );
40 }
41
49 public function getFormFieldNames(string $model, $instance): array {
50 return OrmUtils::getFormAllFields ( $model );
51 }
52
59 public function getSearchFieldNames(string $model): array {
60 return OrmUtils::getSerializableFields ( $model );
61 }
62
69 public function getElementFieldNames(string $model): array {
70 return OrmUtils::getMembers ( $model );
71 }
72
81 public function getManyToManyDatas($fkClass, $instance, $member): array {
82 return DAO::getAll ( $fkClass, "", false );
83 }
84
93 public function getManyToOneDatas($fkClass, $instance, $member):array {
94 return DAO::getAll ( $fkClass, "", false );
95 }
96
105 public function getOneToManyDatas($fkClass, $instance, $member):array {
106 return DAO::getAll ( $fkClass, "", false );
107 }
108
113 public function getUpdateOneToManyInForm(): bool {
114 return false;
115 }
116
121 public function getUpdateManyToManyInForm(): bool {
122 return true;
123 }
124
129 public function getUpdateManyToOneInForm(): bool {
130 return true;
131 }
132
138 public function refreshPartialInstance(): bool {
139 return true;
140 }
141
149 public function _getInstancesFilter(string $model): string {
150 return "1=1";
151 }
152}
The base class for displaying datas in CRUD controllers Ubiquity\controllers\crud$CRUDDatas This clas...
Definition CRUDDatas.php:17
getFieldNames(string $model)
Returns the fields to display in the showModel action for $model (DataTable)
Definition CRUDDatas.php:38
getElementFieldNames(string $model)
Returns the fields for displaying an instance of $model (DataElement)
Definition CRUDDatas.php:69
getTableNames()
Returns the table names to display in the left admin menu.
Definition CRUDDatas.php:28
getManyToManyDatas($fkClass, $instance, $member)
Returns a (filtered) list of $fkClass objects to display in an html list.
Definition CRUDDatas.php:81
refreshPartialInstance()
Defines whether the refresh is partial or complete after an instance update.
getOneToManyDatas($fkClass, $instance, $member)
Returns a list (filtered) of $fkClass objects to display in an html list.
getManyToOneDatas($fkClass, $instance, $member)
Returns a list (filtered) of $fkClass objects to display in an html list.
Definition CRUDDatas.php:93
getFormFieldNames(string $model, $instance)
Returns the fields to update in the edit an new action for $model.
Definition CRUDDatas.php:49
getSearchFieldNames(string $model)
Returns the fields to use in search queries.
Definition CRUDDatas.php:59
_getInstancesFilter(string $model)
Adds a condition for filtering the instances displayed in dataTable Return 1=1 by default.
Gateway class between database and object model.
Definition DAO.php:33
Object/relational mapping utilities.
Definition OrmUtils.php:17