php-cs-fixer doing its thing.
This commit is contained in:
parent
5654ffbf64
commit
cc2e7031c9
9 changed files with 41 additions and 28 deletions
|
|
@ -4,12 +4,13 @@ function detectAndLoadVendor($path = __DIR__): void
|
|||
{
|
||||
$path = realpath($path);
|
||||
if ('/' == $path) {
|
||||
die("Could not find a suitable /vendor directory! Maybe you need to run composer install!\n");
|
||||
exit("Could not find a suitable /vendor directory! Maybe you need to run composer install!\n");
|
||||
}
|
||||
|
||||
foreach (new DirectoryIterator($path) as $fileInfo) {
|
||||
if ($fileInfo->isDir() && 'vendor' == $fileInfo->getFilename()) {
|
||||
define('VENDOR_PATH', $fileInfo->getRealPath());
|
||||
|
||||
require_once VENDOR_PATH.'/autoload.php';
|
||||
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ abstract class AbstractService
|
|||
) {
|
||||
/** @var AbstractTableGateway $tableGateway */
|
||||
$tableGateway = $this->getNewTableGatewayInstance();
|
||||
list($matches, $count) = $tableGateway->fetchAll(
|
||||
[$matches, $count] = $tableGateway->fetchAll(
|
||||
$limit,
|
||||
$offset,
|
||||
$wheres,
|
||||
|
|
@ -62,7 +62,7 @@ abstract class AbstractService
|
|||
) {
|
||||
/** @var AbstractTableGateway $tableGateway */
|
||||
$tableGateway = $this->getNewTableGatewayInstance();
|
||||
list($matches, $count) = $tableGateway->fetchDistinct(
|
||||
[$matches, $count] = $tableGateway->fetchDistinct(
|
||||
$distinctColumn,
|
||||
$wheres
|
||||
);
|
||||
|
|
|
|||
|
|
@ -112,6 +112,7 @@ abstract class AbstractTableGateway extends TableGateway
|
|||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$data = $model->__toRawArray();
|
||||
}
|
||||
|
|
@ -143,6 +144,7 @@ abstract class AbstractTableGateway extends TableGateway
|
|||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
foreach ($model->getPrimaryKeys_dbColumns() as $primaryKey => $dontCare) {
|
||||
$pk[$primaryKey] = $this->getLastInsertValue();
|
||||
|
|
@ -228,42 +230,52 @@ abstract class AbstractTableGateway extends TableGateway
|
|||
$where->equalTo($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
case FilterCondition::CONDITION_NOT_EQUAL:
|
||||
$where->notEqualTo($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
case FilterCondition::CONDITION_GREATER_THAN:
|
||||
$where->greaterThan($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
case FilterCondition::CONDITION_GREATER_THAN_OR_EQUAL:
|
||||
$where->greaterThanOrEqualTo($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
case FilterCondition::CONDITION_LESS_THAN:
|
||||
$where->lessThan($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
case FilterCondition::CONDITION_LESS_THAN_OR_EQUAL:
|
||||
$where->lessThanOrEqualTo($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
case FilterCondition::CONDITION_LIKE:
|
||||
$where->like($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
case FilterCondition::CONDITION_NOT_LIKE:
|
||||
$where->notLike($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
case FilterCondition::CONDITION_IN:
|
||||
$where->in($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
case FilterCondition::CONDITION_NOT_IN:
|
||||
$where->notIn($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new DbRuntimeException("Cannot work out what conditional '{$conditional['condition']}'' is supposed to do in Zend... Probably unimplemented?");
|
||||
}
|
||||
|
|
@ -332,26 +344,32 @@ abstract class AbstractTableGateway extends TableGateway
|
|||
$where->equalTo($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
case FilterCondition::CONDITION_GREATER_THAN:
|
||||
$where->greaterThan($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
case FilterCondition::CONDITION_GREATER_THAN_OR_EQUAL:
|
||||
$where->greaterThanOrEqualTo($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
case FilterCondition::CONDITION_LESS_THAN:
|
||||
$where->lessThan($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
case FilterCondition::CONDITION_LESS_THAN_OR_EQUAL:
|
||||
$where->lessThanOrEqualTo($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
case FilterCondition::CONDITION_LIKE:
|
||||
$where->like($conditional['column'], $conditional['value']);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new DbRuntimeException("Cannot work out what conditional {$conditional['condition']} is supposed to do in Zend... Probably unimplemented?");
|
||||
}
|
||||
|
|
@ -396,10 +414,12 @@ abstract class AbstractTableGateway extends TableGateway
|
|||
$select->order(new Expression('RAND()'));
|
||||
|
||||
break;
|
||||
|
||||
case 'Postgresql':
|
||||
$select->order(new Expression('RANDOM()'));
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new BenzineException("Can't fetchRandom for a {$this->adapter->getDriver()->getDatabasePlatformName()} type database!");
|
||||
}
|
||||
|
|
@ -628,7 +648,6 @@ abstract class AbstractTableGateway extends TableGateway
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $value
|
||||
* @param null|int $limit int
|
||||
* @param null|int $offset int
|
||||
* @param null|string $orderBy string Field to sort by
|
||||
|
|
|
|||
|
|
@ -95,8 +95,6 @@ class Column extends Entity
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $phpType
|
||||
*
|
||||
* @return Column
|
||||
*/
|
||||
public function setPhpType($phpType)
|
||||
|
|
@ -122,8 +120,6 @@ class Column extends Entity
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $field
|
||||
*
|
||||
* @return Column
|
||||
*/
|
||||
public function setField($field)
|
||||
|
|
@ -152,8 +148,6 @@ class Column extends Entity
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $dbField
|
||||
*
|
||||
* @return Column
|
||||
*/
|
||||
public function setDbField($dbField)
|
||||
|
|
@ -174,8 +168,6 @@ class Column extends Entity
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $maxDecimalPlaces
|
||||
*
|
||||
* @return Column
|
||||
*/
|
||||
public function setMaxDecimalPlaces($maxDecimalPlaces)
|
||||
|
|
@ -191,8 +183,6 @@ class Column extends Entity
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $defaultValue
|
||||
*
|
||||
* @return Column
|
||||
*/
|
||||
public function setDefaultValue($defaultValue)
|
||||
|
|
@ -231,8 +221,6 @@ class Column extends Entity
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $maxLength
|
||||
*
|
||||
* @return Column
|
||||
*/
|
||||
public function setMaxLength($maxLength)
|
||||
|
|
@ -248,8 +236,6 @@ class Column extends Entity
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $maxFieldLength
|
||||
*
|
||||
* @return Column
|
||||
*/
|
||||
public function setMaxFieldLength($maxFieldLength)
|
||||
|
|
@ -265,8 +251,6 @@ class Column extends Entity
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $dbType
|
||||
*
|
||||
* @throws DBTypeNotTranslatedException
|
||||
*
|
||||
* @return Column
|
||||
|
|
@ -289,6 +273,7 @@ class Column extends Entity
|
|||
$this->setPhpType('float');
|
||||
|
||||
break;
|
||||
|
||||
case 'bit': // MySQL
|
||||
case 'int': // MySQL
|
||||
case 'integer': // Postgres
|
||||
|
|
@ -299,6 +284,7 @@ class Column extends Entity
|
|||
$this->setPhpType('int');
|
||||
|
||||
break;
|
||||
|
||||
case 'char': // MySQL
|
||||
case 'character': // Postgres
|
||||
case 'varchar': // MySQL
|
||||
|
|
@ -318,11 +304,13 @@ class Column extends Entity
|
|||
$this->setPhpType('string');
|
||||
|
||||
break;
|
||||
|
||||
case 'timestamp': // MySQL
|
||||
case 'datetime': // MySQL
|
||||
$this->setPhpType('\\'.DateTime::class);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new DBTypeNotTranslatedException("Type not translated: {$this->getDbType()}");
|
||||
}
|
||||
|
|
@ -336,8 +324,6 @@ class Column extends Entity
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $permittedValues
|
||||
*
|
||||
* @return Column
|
||||
*/
|
||||
public function setPermittedValues($permittedValues)
|
||||
|
|
|
|||
|
|
@ -125,8 +125,7 @@ class Model extends Entity
|
|||
$this->transStudly2Studly->transform($this->getTableSanitised());
|
||||
}
|
||||
|
||||
return
|
||||
$this->transStudly2Studly->transform($this->getTableSanitised());
|
||||
return $this->transStudly2Studly->transform($this->getTableSanitised());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -273,6 +272,7 @@ class Model extends Entity
|
|||
$oColumn->setPermittedValues($column->getErrata('permitted_values'));
|
||||
|
||||
break;
|
||||
|
||||
case 'Postgresql':
|
||||
if ('USER-DEFINED' == $column->getDataType()) {
|
||||
$enumName = explode('::', $column->getColumnDefault(), 2)[1];
|
||||
|
|
@ -284,6 +284,7 @@ class Model extends Entity
|
|||
}
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new BenzineException("Cannot get permitted values for field {$oColumn->getField()} for platform {$this->getDatabase()->getAdapter()->getDriver()->getDatabasePlatformName()}");
|
||||
}
|
||||
|
|
@ -299,24 +300,29 @@ class Model extends Entity
|
|||
$oColumn->setMaxFieldLength(9223372036854775807);
|
||||
|
||||
break;
|
||||
|
||||
case 'int': // mysql
|
||||
case 'integer': // postgres
|
||||
case 'serial': // postgres
|
||||
$oColumn->setMaxFieldLength(2147483647);
|
||||
|
||||
break;
|
||||
|
||||
case 'mediumint': // mysql
|
||||
$oColumn->setMaxFieldLength(8388607);
|
||||
|
||||
break;
|
||||
|
||||
case 'smallint': // mysql & postgres
|
||||
$oColumn->setMaxFieldLength(32767);
|
||||
|
||||
break;
|
||||
|
||||
case 'tinyint': // mysql
|
||||
$oColumn->setMaxFieldLength(127);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
$oColumn->setMaxLength($column->getCharacterMaximumLength());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ class RelatedModel extends Entity
|
|||
|
||||
public function getLocalVariable(): string
|
||||
{
|
||||
return $this->transStudly2Camel->transform(
|
||||
return $this->transStudly2Camel->transform(
|
||||
$this->getLocalClassPrefix().
|
||||
$this->transCamel2Studly->transform($this->getLocalTableSanitised())
|
||||
);
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ class Table extends AbstractEntity
|
|||
}
|
||||
|
||||
/**
|
||||
* @param mixed $tableName
|
||||
*
|
||||
* @return Table
|
||||
*/
|
||||
public function setTableName($tableName)
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ class Laminator
|
|||
echo "\n\n";
|
||||
echo $exception->getTraceAsString();
|
||||
echo "\n\n";
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
|
@ -244,6 +245,7 @@ class Laminator
|
|||
}
|
||||
|
||||
return $columns;
|
||||
|
||||
case 'Postgresql':
|
||||
$sql = "SELECT column_name FROM information_schema.COLUMNS WHERE TABLE_NAME = '{$table}' AND column_default LIKE 'nextval(%'";
|
||||
$query = $database->getAdapter()->query($sql);
|
||||
|
|
@ -254,6 +256,7 @@ class Laminator
|
|||
}
|
||||
|
||||
return $columns;
|
||||
|
||||
default:
|
||||
throw new BenzineException("Don't know how to get autoincrement columns for {$database->getAdapter()->getDriver()->getDatabasePlatformName()}!");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ class Profiler implements ProfilerInterface
|
|||
public function getQueries(QueryStatisticInterface $queryStatisticClass = null): array
|
||||
{
|
||||
$stats = [];
|
||||
foreach ($this->queries as $uuid => list($query, $backTrace)) {
|
||||
foreach ($this->queries as $uuid => [$query, $backTrace]) {
|
||||
if ($queryStatisticClass) {
|
||||
if (is_object($queryStatisticClass)) {
|
||||
$queryStatisticClass = get_class($queryStatisticClass);
|
||||
|
|
|
|||
Loading…
Reference in a new issue