Completed
Push — master ( f64d9c...5ef3c4 )
by Jean-Christophe
01:47
created

UbiquityMyAdminData   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 57
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 57
rs 10
1
<?php
2
namespace micro\controllers\admin;
3
use micro\orm\DAO;
4
use micro\orm\OrmUtils;
5
6
/**
7
 * The base class for displaying datas in UbiquityMyAdminController
8
 * @author jc
9
 *
10
 */
11
class UbiquityMyAdminData {
12
13
	/**
14
	 * Returns the table names to display in the left admin menu
15
	 */
16
	public function getTableNames(){
17
		return DAO::$db->getTablesName();
18
	}
19
20
	/**
21
	 * Returns the fields to display in the showTable action for $model
22
	 * @param string $model
23
	 */
24
	public function getFieldNames($model){
25
		return OrmUtils::getSerializableFields($model);
26
	}
27
28
	/**
29
	 * Returns the fields to update in the edit an new action for $model
30
	 * @param string $model
31
	 */
32
	public function getFormFieldNames($model){
33
		return OrmUtils::getSerializableFields($model);
34
	}
35
36
	/**
37
	 * Returns a list of $fkClass objects to select a value for $member
38
	 * @param string $fkClass
39
	 * @param object $instance
40
	 * @param string $member
41
	 * @return array
42
	 */
43
	public function getManyToManyDatas($fkClass,$instance,$member){
44
		return DAO::getAll($fkClass);
45
	}
46
47
	/**
48
	 * @return boolean
49
	 */
50
	public function getUpdateOneToManyInForm() {
51
		return false;
52
	}
53
54
	/**
55
	 * @return boolean
56
	 */
57
	public function getUpdateManyToManyInForm() {
58
		return true;
59
	}
60
61
	/**
62
	 * @return boolean
63
	 */
64
	public function getUpdateManyToOneInForm() {
65
		return true;
66
	}
67
}
68