@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | if ($this->daoNamespace == null && $this->beanNamespace == null) { |
62 | - $classNameMapper = ClassNameMapper::createFromComposerFile(__DIR__.'/../../../../../../../../composer.json'); |
|
62 | + $classNameMapper = ClassNameMapper::createFromComposerFile(__DIR__.'/../../../../../../../../composer.json'); |
|
63 | 63 | |
64 | 64 | $autoloadNamespaces = $classNameMapper->getManagedNamespaces(); |
65 | - if ($autoloadNamespaces) { |
|
65 | + if ($autoloadNamespaces) { |
|
66 | 66 | $this->autoloadDetected = true; |
67 | 67 | $rootNamespace = $autoloadNamespaces[0]; |
68 | 68 | $this->daoNamespace = $rootNamespace."Dao"; |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | |
139 | 139 | $tdbmService = new InstanceProxy($name); |
140 | 140 | /* @var $tdbmService TDBMService */ |
141 | - $tables = $tdbmService->generateAllDaosAndBeans($daofactoryclassname, $daonamespace, $beannamespace, $storeInUtc); |
|
141 | + $tables = $tdbmService->generateAllDaosAndBeans($daofactoryclassname, $daonamespace, $beannamespace, $storeInUtc); |
|
142 | 142 | |
143 | 143 | |
144 | 144 | $moufManager->declareComponent($daofactoryinstancename, $daonamespace."\\".$daofactoryclassname, false, MoufManager::DECLARE_ON_EXIST_KEEP_INCOMING_LINKS); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @Action |
41 | 41 | * //@Admin |
42 | 42 | */ |
43 | - public function defaultAction($name, $selfedit="false") { |
|
43 | + public function defaultAction($name, $selfedit = "false") { |
|
44 | 44 | $this->initController($name, $selfedit); |
45 | 45 | |
46 | 46 | // Fill variables |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @param string $name |
88 | 88 | * @param bool $selfedit |
89 | 89 | */ |
90 | - public function generate($name, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $storeInUtc = 0, $selfedit="false") { |
|
90 | + public function generate($name, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $storeInUtc = 0, $selfedit = "false") { |
|
91 | 91 | $this->initController($name, $selfedit); |
92 | 92 | |
93 | 93 | self::generateDaos($this->moufManager, $name, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $selfedit, $storeInUtc); |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * @param bool $storeInUtc |
109 | 109 | * @throws \Mouf\MoufException |
110 | 110 | */ |
111 | - public static function generateDaos(MoufManager $moufManager, $name, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $selfedit="false", $storeInUtc = null) { |
|
111 | + public static function generateDaos(MoufManager $moufManager, $name, $daonamespace, $beannamespace, $daofactoryclassname, $daofactoryinstancename, $selfedit = "false", $storeInUtc = null) { |
|
112 | 112 | $moufManager->setVariable("tdbmDefaultDaoNamespace_".$name, $daonamespace); |
113 | 113 | $moufManager->setVariable("tdbmDefaultBeanNamespace_".$name, $beannamespace); |
114 | 114 | $moufManager->setVariable("tdbmDefaultDaoFactoryName_".$name, $daofactoryclassname); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $moufManager->bindComponentViaSetter($instanceName, "setTdbmService", $name); |
156 | 156 | $moufManager->bindComponentViaSetter($daofactoryinstancename, "set".$daoName, $instanceName); |
157 | 157 | |
158 | - $tableToBeanMap[$table] = $beannamespace . "\\" . TDBMDaoGenerator::getBeanNameFromTableName($table); |
|
158 | + $tableToBeanMap[$table] = $beannamespace."\\".TDBMDaoGenerator::getBeanNameFromTableName($table); |
|
159 | 159 | } |
160 | 160 | $tdbmServiceDescriptor = $moufManager->getInstanceDescriptor($name); |
161 | 161 | $tdbmServiceDescriptor->getSetterProperty("setTableToBeanMap")->setValue($tableToBeanMap); |
@@ -45,7 +45,7 @@ |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | private function getAllPossiblePaths() { |
48 | - return AmbiguityException::getAllPossiblePathsRec($this->paths); |
|
48 | + return AmbiguityException::getAllPossiblePathsRec($this->paths); |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | private static function getAllPossiblePathsRec($sub_table_paths) |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | public function explainAmbiguity() { |
20 | 20 | $all_paths = $this->getAllPossiblePaths(); |
21 | 21 | |
22 | - $i=0; |
|
22 | + $i = 0; |
|
23 | 23 | $width_px = 0; |
24 | 24 | $height_px = 0; |
25 | 25 | $global_height_px = 0; |
@@ -50,11 +50,11 @@ discard block |
||
50 | 50 | |
51 | 51 | private static function getAllPossiblePathsRec($sub_table_paths) |
52 | 52 | { |
53 | - if (count($sub_table_paths)==0) |
|
53 | + if (count($sub_table_paths) == 0) |
|
54 | 54 | return array(); |
55 | 55 | |
56 | 56 | $table_path = array_shift($sub_table_paths); |
57 | - $possible_sub_paths = AmbiguityException::getAllPossiblePathsRec($sub_table_paths); |
|
57 | + $possible_sub_paths = AmbiguityException::getAllPossiblePathsRec($sub_table_paths); |
|
58 | 58 | $return_table_paths = array(); |
59 | 59 | foreach ($table_path['paths'] as $path) { |
60 | 60 | if (count($possible_sub_paths)>0) |
@@ -50,8 +50,9 @@ discard block |
||
50 | 50 | |
51 | 51 | private static function getAllPossiblePathsRec($sub_table_paths) |
52 | 52 | { |
53 | - if (count($sub_table_paths)==0) |
|
54 | - return array(); |
|
53 | + if (count($sub_table_paths)==0) { |
|
54 | + return array(); |
|
55 | + } |
|
55 | 56 | |
56 | 57 | $table_path = array_shift($sub_table_paths); |
57 | 58 | $possible_sub_paths = AmbiguityException::getAllPossiblePathsRec($sub_table_paths); |
@@ -63,9 +64,9 @@ discard block |
||
63 | 64 | { |
64 | 65 | $return_table_paths[] = array_merge(array(array('paths'=>array($path))), $possible_sub_path); |
65 | 66 | } |
67 | + } else { |
|
68 | + $return_table_paths[] = array(array('paths'=>array($path))); |
|
66 | 69 | } |
67 | - else |
|
68 | - $return_table_paths[] = array(array('paths'=>array($path))); |
|
69 | 70 | } |
70 | 71 | return $return_table_paths; |
71 | 72 | } |
@@ -25,10 +25,10 @@ |
||
25 | 25 | * @author David Negrier |
26 | 26 | */ |
27 | 27 | final class TDBMObjectStateEnum extends AbstractTDBMObject { |
28 | - const STATE_DETACHED = "detached"; |
|
29 | - const STATE_NEW = "new"; |
|
30 | - const STATE_NOT_LOADED = "not loaded"; |
|
31 | - const STATE_LOADED = "loaded"; |
|
32 | - const STATE_DIRTY = "dirty"; |
|
33 | - const STATE_DELETED = "deleted"; |
|
28 | + const STATE_DETACHED = "detached"; |
|
29 | + const STATE_NEW = "new"; |
|
30 | + const STATE_NOT_LOADED = "not loaded"; |
|
31 | + const STATE_LOADED = "loaded"; |
|
32 | + const STATE_DIRTY = "dirty"; |
|
33 | + const STATE_DELETED = "deleted"; |
|
34 | 34 | } |
@@ -77,7 +77,7 @@ |
||
77 | 77 | |
78 | 78 | |
79 | 79 | private function toIndex($offset) { |
80 | - if ($offset < 0 || filter_var($offset, FILTER_VALIDATE_INT) === false) { |
|
80 | + if ($offset<0 || filter_var($offset, FILTER_VALIDATE_INT) === false) { |
|
81 | 81 | throw new TDBMInvalidOffsetException('Trying to access result set using offset "'.$offset.'". An offset must be a positive integer.'); |
82 | 82 | } |
83 | 83 | if ($this->statement === null) { |
@@ -65,9 +65,9 @@ |
||
65 | 65 | * @param string $func_name |
66 | 66 | * @param $values |
67 | 67 | * @return array|void |
68 | - * @throws TDBMException |
|
68 | + * @throws TDBMException |
|
69 | 69 | */ |
70 | - public function __call($func_name, $values) { |
|
70 | + public function __call($func_name, $values) { |
|
71 | 71 | |
72 | 72 | if (strpos($func_name,"getarray_") === 0) { |
73 | 73 | $column = substr($func_name, 9); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | class TDBMObjectArray extends \ArrayObject implements \JsonSerializable { |
29 | 29 | public function __get($var) { |
30 | 30 | $cnt = count($this); |
31 | - if ($cnt==1) |
|
31 | + if ($cnt == 1) |
|
32 | 32 | { |
33 | 33 | return $this[0]->__get($var); |
34 | 34 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | |
45 | 45 | public function __set($var, $value) { |
46 | 46 | $cnt = count($this); |
47 | - if ($cnt==1) |
|
47 | + if ($cnt == 1) |
|
48 | 48 | { |
49 | 49 | return $this[0]->__set($var, $value); |
50 | 50 | } |
@@ -69,13 +69,13 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function __call($func_name, $values) { |
71 | 71 | |
72 | - if (strpos($func_name,"getarray_") === 0) { |
|
72 | + if (strpos($func_name, "getarray_") === 0) { |
|
73 | 73 | $column = substr($func_name, 9); |
74 | 74 | return $this->getarray($column); |
75 | - } elseif (strpos($func_name,"setarray_") === 0) { |
|
75 | + } elseif (strpos($func_name, "setarray_") === 0) { |
|
76 | 76 | $column = substr($func_name, 9); |
77 | 77 | return $this->setarray($column, $values[0]); |
78 | - } elseif (count($this)==1) { |
|
78 | + } elseif (count($this) == 1) { |
|
79 | 79 | $this[0]->__call($func_name, $values); |
80 | 80 | } |
81 | 81 | else |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
102 | - public function jsonSerialize(){ |
|
102 | + public function jsonSerialize() { |
|
103 | 103 | return (array) $this; |
104 | 104 | } |
105 | 105 | } |
@@ -31,12 +31,10 @@ discard block |
||
31 | 31 | if ($cnt==1) |
32 | 32 | { |
33 | 33 | return $this[0]->__get($var); |
34 | - } |
|
35 | - elseif ($cnt>1) |
|
34 | + } elseif ($cnt>1) |
|
36 | 35 | { |
37 | 36 | throw new TDBMException('Array contains many objects! Use getarray_'.$var.' to retrieve an array of '.$var); |
38 | - } |
|
39 | - else |
|
37 | + } else |
|
40 | 38 | { |
41 | 39 | throw new TDBMException('Array contains no objects'); |
42 | 40 | } |
@@ -47,12 +45,10 @@ discard block |
||
47 | 45 | if ($cnt==1) |
48 | 46 | { |
49 | 47 | return $this[0]->__set($var, $value); |
50 | - } |
|
51 | - elseif ($cnt>1) |
|
48 | + } elseif ($cnt>1) |
|
52 | 49 | { |
53 | 50 | throw new TDBMException('Array contains many objects! Use setarray_'.$var.' to set the array of '.$var); |
54 | - } |
|
55 | - else |
|
51 | + } else |
|
56 | 52 | { |
57 | 53 | throw new TDBMException('Array contains no objects'); |
58 | 54 | } |
@@ -77,8 +73,7 @@ discard block |
||
77 | 73 | return $this->setarray($column, $values[0]); |
78 | 74 | } elseif (count($this)==1) { |
79 | 75 | $this[0]->__call($func_name, $values); |
80 | - } |
|
81 | - else |
|
76 | + } else |
|
82 | 77 | { |
83 | 78 | throw new TDBMException("Method ".$func_name." not found"); |
84 | 79 | } |
@@ -18,7 +18,6 @@ |
||
18 | 18 | along with this program; if not, write to the Free Software |
19 | 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
20 | 20 | */ |
21 | -use Doctrine\DBAL\Driver\Connection; |
|
22 | 21 | |
23 | 22 | |
24 | 23 | /** |
@@ -18,7 +18,6 @@ |
||
18 | 18 | along with this program; if not, write to the Free Software |
19 | 19 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
20 | 20 | */ |
21 | -use Doctrine\DBAL\Driver\Connection; |
|
22 | 21 | |
23 | 22 | |
24 | 23 | /** |
@@ -70,6 +70,13 @@ discard block |
||
70 | 70 | |
71 | 71 | private $mode; |
72 | 72 | |
73 | + /** |
|
74 | + * @param string $magicSql |
|
75 | + * @param string $magicSqlCount |
|
76 | + * @param WeakrefObjectStorage $objectStorage |
|
77 | + * @param string|null $className |
|
78 | + * @param integer $mode |
|
79 | + */ |
|
73 | 80 | public function __construct($magicSql, $magicSqlCount, array $parameters, array $columnDescriptors, $objectStorage, $className, TDBMService $tdbmService, MagicQuery $magicQuery, $mode) |
74 | 81 | { |
75 | 82 | $this->magicSql = $magicSql; |
@@ -166,6 +173,7 @@ discard block |
||
166 | 173 | |
167 | 174 | /** |
168 | 175 | * @param int $offset |
176 | + * @param integer $limit |
|
169 | 177 | * @return PageIterator |
170 | 178 | */ |
171 | 179 | public function take($offset, $limit) |
@@ -85,7 +85,7 @@ |
||
85 | 85 | * @param string $columnName |
86 | 86 | * @param string $value |
87 | 87 | */ |
88 | - public function __construct($tableName=null, $columnName=null, $value=null) { |
|
88 | + public function __construct($tableName = null, $columnName = null, $value = null) { |
|
89 | 89 | $this->tableName = $tableName; |
90 | 90 | $this->columnName = $columnName; |
91 | 91 | $this->value = $value; |
@@ -85,7 +85,7 @@ |
||
85 | 85 | * @param string $columnName |
86 | 86 | * @param string $value |
87 | 87 | */ |
88 | - public function __construct($tableName=null, $columnName=null, $value=null) { |
|
88 | + public function __construct($tableName = null, $columnName = null, $value = null) { |
|
89 | 89 | $this->tableName = $tableName; |
90 | 90 | $this->columnName = $columnName; |
91 | 91 | $this->value = $value; |