Skip to content

Commit a5e2261

Browse files
authored
Merge pull request #35 from Planetbiru/feature/2.7.1
Feature/2.7.1
2 parents 9bd3d9b + 4387784 commit a5e2261

34 files changed

+244
-156
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
}
1414
],
1515
"require": {
16-
"symfony/yaml": "3.4"
16+
"php": ">=5.4",
17+
"symfony/yaml": "^3.4"
1718
}
1819
}

composer.lock

Lines changed: 105 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Database/PicoDatabase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ public function fetch($sql, $tentativeType = PDO::FETCH_ASSOC, $defaultValue = n
626626
throw new NullPointerException(self::DATABASE_NONECTION_IS_NULL);
627627
}
628628

629-
$result = [];
629+
$result = array();
630630
$this->executeDebug($sql);
631631
$stmt = $this->databaseConnection->prepare($sql);
632632

@@ -703,7 +703,7 @@ public function fetchAll($sql, $tentativeType = PDO::FETCH_ASSOC, $defaultValue
703703
throw new NullPointerException(self::DATABASE_NONECTION_IS_NULL);
704704
}
705705

706-
$result = [];
706+
$result = array();
707707
$this->executeDebug($sql);
708708
$stmt = $this->databaseConnection->prepare($sql);
709709

src/Database/PicoDatabaseEntity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class PicoDatabaseEntity
2020
*
2121
* @var PicoDatabase[]
2222
*/
23-
private $databases = [];
23+
private $databases = array();
2424

2525
/**
2626
* Default database connection

src/Database/PicoDatabasePersistence.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
use MagicObject\Exceptions\EntityException;
1212
use MagicObject\Exceptions\InvalidAnnotationException;
1313
use MagicObject\Exceptions\InvalidFilterException;
14-
use MagicObject\Exceptions\InvalidQueryInputException;
1514
use MagicObject\Exceptions\NoInsertableColumnException;
1615
use MagicObject\Exceptions\NoColumnMatchException;
1716
use MagicObject\Exceptions\NoDatabaseConnectionException;
@@ -297,15 +296,15 @@ public function includeNull($skip)
297296
* @param string $queryString The key-value string to parse
298297
* @param string $parameter The name of the parameter being parsed
299298
* @return array Parsed key-value pairs
300-
* @throws InvalidAnnotationException If the query string is invalid
299+
* @throws InvalidAnnotationException If the annotations are invalid or cannot be parsed.
301300
*/
302301
private function parseKeyValue($reflexClass, $queryString, $parameter)
303302
{
304303
try
305304
{
306305
return $reflexClass->parseKeyValue($queryString);
307306
}
308-
catch(InvalidQueryInputException $e)
307+
catch(InvalidAnnotationException $e)
309308
{
310309
throw new InvalidAnnotationException("Invalid annotation @".$parameter);
311310
}

src/Database/PicoDatabaseStructure.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
namespace MagicObject\Database;
33

44
use MagicObject\Exceptions\InvalidAnnotationException;
5-
use MagicObject\Exceptions\InvalidQueryInputException;
65
use MagicObject\Exceptions\MandatoryTableNameException;
76
use MagicObject\Util\ClassUtil\PicoAnnotationParser;
87

@@ -122,13 +121,13 @@ private function nullable($nullable)
122121
* @param string $queryString The string to be parsed.
123122
* @param string $parameter The parameter name for error reporting.
124123
* @return array The parsed key-value pairs.
125-
* @throws InvalidAnnotationException If the annotation is invalid.
124+
* @throws InvalidAnnotationException If the annotations are invalid or cannot be parsed.
126125
*/
127126
private function parseKeyValue($reflexClass, $queryString, $parameter)
128127
{
129128
try {
130129
return $reflexClass->parseKeyValue($queryString);
131-
} catch (InvalidQueryInputException $e) {
130+
} catch (InvalidAnnotationException $e) {
132131
throw new InvalidAnnotationException("Invalid annotation @" . $parameter);
133132
}
134133
}

src/Database/PicoEntityLabel.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace MagicObject\Database;
44

55
use MagicObject\Exceptions\InvalidAnnotationException;
6-
use MagicObject\Exceptions\InvalidQueryInputException;
76
use MagicObject\MagicObject;
87
use MagicObject\Util\ClassUtil\PicoAnnotationParser;
98
use stdClass;
@@ -135,13 +134,13 @@ private function filter(array $merged, $lang)
135134
* @param string $queryString The query string to parse.
136135
* @param string $parameter The parameter name.
137136
* @return array The parsed key-value pairs.
138-
* @throws InvalidAnnotationException If the query input is invalid.
137+
* @throws InvalidAnnotationException If the annotations are invalid or cannot be parsed.
139138
*/
140139
private function parseKeyValue(PicoAnnotationParser $reflexClass, $queryString, $parameter)
141140
{
142141
try {
143142
return $reflexClass->parseKeyValue($queryString);
144-
} catch (InvalidQueryInputException $e) {
143+
} catch (InvalidAnnotationException $e) {
145144
throw new InvalidAnnotationException("Invalid annotation @" . $parameter);
146145
}
147146
}

src/Generator/PicoDatabaseDump.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,13 @@ public function createAlterTableAddFromEntities($entities, $tableName = null, $d
246246
$tableName = $this->getTableName($tableName, $tableInfo);
247247
$database = $this->getDatabase($database, $entities);
248248

249-
$queryAlter = [];
249+
$queryAlter = array();
250250
$numberOfColumn = count($tableInfo->getColumns());
251251

252252
if (!empty($tableInfo->getColumns())) {
253-
$dbColumnNames = [];
253+
$dbColumnNames = array();
254254
$rows = PicoColumnGenerator::getColumnList($database, $tableInfo->getTableName());
255-
$createdColumns = [];
255+
$createdColumns = array();
256256
if (is_array($rows) && !empty($rows)) {
257257
foreach ($rows as $row) {
258258
$dbColumnNames[] = $row['Field'];
@@ -290,13 +290,13 @@ public function createAlterTableAddFromEntity($entity)
290290
$tableName = $tableInfo->getTableName();
291291
$database = $entity->currentDatabase();
292292

293-
$queryAlter = [];
293+
$queryAlter = array();
294294
$numberOfColumn = count($tableInfo->getColumns());
295295

296296
if (!empty($tableInfo->getColumns())) {
297-
$dbColumnNames = [];
297+
$dbColumnNames = array();
298298
$rows = PicoColumnGenerator::getColumnList($database, $tableInfo->getTableName());
299-
$createdColumns = [];
299+
$createdColumns = array();
300300
if (is_array($rows) && !empty($rows)) {
301301
foreach ($rows as $row) {
302302
$dbColumnNames[] = $row['Field'];
@@ -334,7 +334,7 @@ public function createAlterTableAddFromEntity($entity)
334334
private function addPrimaryKey($queryAlter, $tableInfo, $tableName, $createdColumns)
335335
{
336336
$pk = $tableInfo->getPrimaryKeys();
337-
$queries = [];
337+
$queries = array();
338338
if (isset($pk) && is_array($pk) && !empty($pk)) {
339339
foreach ($pk as $primaryKey) {
340340
if (in_array($primaryKey['name'], $createdColumns)) {
@@ -361,7 +361,7 @@ private function addPrimaryKey($queryAlter, $tableInfo, $tableName, $createdColu
361361
*/
362362
private function addAutoIncrement($queryAlter, $tableInfo, $tableName, $createdColumns, $databaseType)
363363
{
364-
$queries = [];
364+
$queries = array();
365365
$aik = $this->getAutoIncrementKey($tableInfo);
366366

367367
foreach ($tableInfo->getColumns() as $entityColumn) {
@@ -399,7 +399,7 @@ private function addAutoIncrement($queryAlter, $tableInfo, $tableName, $createdC
399399
public function getAutoIncrementKey($tableInfo)
400400
{
401401
$autoIncrement = $tableInfo->getAutoIncrementKeys();
402-
$autoIncrementKeys = [];
402+
$autoIncrementKeys = array();
403403

404404
if (is_array($autoIncrement) && !empty($autoIncrement)) {
405405
foreach ($autoIncrement as $col) {

src/Generator/PicoDtoGenerator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function __construct($database, $baseDir, $tableName, $baseNamespaceDto,
108108
protected function createProperty($typeMap, $columnName, $columnType)
109109
{
110110
$propertyName = PicoStringUtil::camelize($columnName);
111-
$docs = [];
111+
$docs = array();
112112
$docStart = "\t/**";
113113
$docEnd = "\t */";
114114

@@ -247,7 +247,7 @@ public function generate()
247247

248248
$rows = PicoColumnGenerator::getColumnList($this->database, $picoTableName);
249249

250-
$attrs = [];
250+
$attrs = array();
251251
if (is_array($rows)) {
252252
foreach ($rows as $row) {
253253
$columnName = $row['Field'];

src/Generator/PicoEntityGenerator.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ protected function createProperty($typeMap, $row, $nonupdatables = null)
9999
$description = $this->getPropertyName($columnName);
100100
$type = $this->getDataType($typeMap, $columnType);
101101

102-
$docs = [];
102+
$docs = array();
103103
$docStart = "\t/**";
104104
$docEnd = "\t */";
105105

@@ -122,7 +122,7 @@ protected function createProperty($typeMap, $row, $nonupdatables = null)
122122
$docs[] = "\t * @NotNull";
123123
}
124124

125-
$attrs = [];
125+
$attrs = array();
126126
$attrs[] = "name=\"$columnName\"";
127127
$attrs[] = "type=\"$columnType\"";
128128
$length = $this->getDataLength($columnType);
@@ -267,7 +267,7 @@ public function generate($nonupdatables = null)
267267

268268
$rows = PicoColumnGenerator::getColumnList($this->database, $picoTableName);
269269

270-
$attrs = [];
270+
$attrs = array();
271271
if (is_array($rows)) {
272272
foreach ($rows as $row) {
273273
$prop = $this->createProperty($typeMap, $row, $nonupdatables);

0 commit comments

Comments
 (0)