Skip to content
Permalink
Browse files

Remove deprecated method calls

  • Loading branch information...
chinpei215 committed Jul 27, 2017
1 parent 0a5bf84 commit a38cb750cfe40a556a366bc7642239ba60eb7ac1
@@ -207,9 +207,9 @@ public function convertIndexDescription(TableSchema $schema, $row)
$type === Table::INDEX_FULLTEXT
);
if ($isIndex) {
$existing = $schema->index($name);
$existing = $schema->getIndex($name);
} else {
$existing = $schema->constraint($name);
$existing = $schema->getConstraint($name);
}
// MySQL multi column indexes come back as multiple rows.
@@ -299,7 +299,7 @@ public function createTableSql(TableSchema $schema, $columns, $constraints, $ind
*/
public function columnSql(TableSchema $schema, $name)
{
$data = $schema->column($name);
$data = $schema->getColumn($name);
$out = $this->_driver->quoteIdentifier($name);
$nativeJson = $this->_driver->supportsNativeJson();
@@ -441,7 +441,7 @@ public function columnSql(TableSchema $schema, $name)
*/
public function constraintSql(TableSchema $schema, $name)
{
$data = $schema->constraint($name);
$data = $schema->getConstraint($name);
if ($data['type'] === Table::CONSTRAINT_PRIMARY) {
$columns = array_map(
[$this->_driver, 'quoteIdentifier'],
@@ -472,7 +472,7 @@ public function addConstraintSql(TableSchema $schema)
$sql = [];
foreach ($schema->constraints() as $name) {
$constraint = $schema->constraint($name);
$constraint = $schema->getConstraint($name);
if ($constraint['type'] === Table::CONSTRAINT_FOREIGN) {
$tableName = $this->_driver->quoteIdentifier($schema->name());
$sql[] = sprintf($sqlPattern, $tableName, $this->constraintSql($schema, $name));
@@ -491,7 +491,7 @@ public function dropConstraintSql(TableSchema $schema)
$sql = [];
foreach ($schema->constraints() as $name) {
$constraint = $schema->constraint($name);
$constraint = $schema->getConstraint($name);
if ($constraint['type'] === Table::CONSTRAINT_FOREIGN) {
$tableName = $this->_driver->quoteIdentifier($schema->name());
$constraintName = $this->_driver->quoteIdentifier($name);
@@ -507,7 +507,7 @@ public function dropConstraintSql(TableSchema $schema)
*/
public function indexSql(TableSchema $schema, $name)
{
$data = $schema->index($name);
$data = $schema->getIndex($name);
$out = '';
if ($data['type'] === Table::INDEX_INDEX) {
$out = 'KEY ';
@@ -250,7 +250,7 @@ public function convertIndexDescription(TableSchema $schema, $row)
return;
}
$index = $schema->index($name);
$index = $schema->getIndex($name);
if (!$index) {
$index = [
'type' => $type,
@@ -272,7 +272,7 @@ public function convertIndexDescription(TableSchema $schema, $row)
*/
protected function _convertConstraint($schema, $name, $type, $row)
{
$constraint = $schema->constraint($name);
$constraint = $schema->getConstraint($name);
if (!$constraint) {
$constraint = [
'type' => $type,
@@ -349,7 +349,7 @@ protected function _convertOnClause($clause)
*/
public function columnSql(TableSchema $schema, $name)
{
$data = $schema->column($name);
$data = $schema->getColumn($name);
$out = $this->_driver->quoteIdentifier($name);
$typeMap = [
TableSchema::TYPE_TINYINTEGER => ' SMALLINT',
@@ -443,7 +443,7 @@ public function addConstraintSql(TableSchema $schema)
$sql = [];
foreach ($schema->constraints() as $name) {
$constraint = $schema->constraint($name);
$constraint = $schema->getConstraint($name);
if ($constraint['type'] === TableSchema::CONSTRAINT_FOREIGN) {
$tableName = $this->_driver->quoteIdentifier($schema->name());
$sql[] = sprintf($sqlPattern, $tableName, $this->constraintSql($schema, $name));
@@ -462,7 +462,7 @@ public function dropConstraintSql(TableSchema $schema)
$sql = [];
foreach ($schema->constraints() as $name) {
$constraint = $schema->constraint($name);
$constraint = $schema->getConstraint($name);
if ($constraint['type'] === TableSchema::CONSTRAINT_FOREIGN) {
$tableName = $this->_driver->quoteIdentifier($schema->name());
$constraintName = $this->_driver->quoteIdentifier($name);
@@ -478,7 +478,7 @@ public function dropConstraintSql(TableSchema $schema)
*/
public function indexSql(TableSchema $schema, $name)
{
$data = $schema->index($name);
$data = $schema->getIndex($name);
$columns = array_map(
[$this->_driver, 'quoteIdentifier'],
$data['columns']
@@ -497,7 +497,7 @@ public function indexSql(TableSchema $schema, $name)
*/
public function constraintSql(TableSchema $schema, $name)
{
$data = $schema->constraint($name);
$data = $schema->getConstraint($name);
$out = 'CONSTRAINT ' . $this->_driver->quoteIdentifier($name);
if ($data['type'] === TableSchema::CONSTRAINT_PRIMARY) {
$out = 'PRIMARY KEY';
@@ -551,7 +551,7 @@ public function createTableSql(TableSchema $schema, $columns, $constraints, $ind
$out[] = $index;
}
foreach ($schema->columns() as $column) {
$columnData = $schema->column($column);
$columnData = $schema->getColumn($column);
if (isset($columnData['comment'])) {
$out[] = sprintf(
'COMMENT ON COLUMN %s.%s IS %s',
@@ -144,7 +144,7 @@ public function convertColumnDescription(TableSchema $schema, $row)
'null' => !$row['notnull'],
'default' => $this->_defaultValue($row['dflt_value']),
];
$primary = $schema->constraint('primary');
$primary = $schema->getConstraint('primary');
if ($row['pk'] && empty($primary)) {
$field['null'] = false;
@@ -154,12 +154,12 @@ public function convertColumnDescription(TableSchema $schema, $row)
// SQLite does not support autoincrement on composite keys.
if ($row['pk'] && !empty($primary)) {
$existingColumn = $primary['columns'][0];
$schema->addColumn($existingColumn, ['autoIncrement' => null] + $schema->column($existingColumn));
$schema->addColumn($existingColumn, ['autoIncrement' => null] + $schema->getColumn($existingColumn));
}
$schema->addColumn($row['name'], $field);
if ($row['pk']) {
$constraint = (array)$schema->constraint('primary') + [
$constraint = (array)$schema->getConstraint('primary') + [
'type' => TableSchema::CONSTRAINT_PRIMARY,
'columns' => []
];
@@ -282,7 +282,7 @@ public function convertForeignKeyDescription(TableSchema $schema, $row)
*/
public function columnSql(TableSchema $schema, $name)
{
$data = $schema->column($name);
$data = $schema->getColumn($name);
$typeMap = [
TableSchema::TYPE_UUID => ' CHAR(36)',
TableSchema::TYPE_TINYINTEGER => ' TINYINT',
@@ -381,10 +381,10 @@ public function columnSql(TableSchema $schema, $name)
*/
public function constraintSql(TableSchema $schema, $name)
{
$data = $schema->constraint($name);
$data = $schema->getConstraint($name);
if ($data['type'] === TableSchema::CONSTRAINT_PRIMARY &&
count($data['columns']) === 1 &&
$schema->column($data['columns'][0])['type'] === TableSchema::TYPE_INTEGER
$schema->getColumn($data['columns'][0])['type'] === TableSchema::TYPE_INTEGER
) {
return '';
}
@@ -448,7 +448,7 @@ public function dropConstraintSql(TableSchema $schema)
*/
public function indexSql(TableSchema $schema, $name)
{
$data = $schema->index($name);
$data = $schema->getIndex($name);
$columns = array_map(
[$this->_driver, 'quoteIdentifier'],
$data['columns']
@@ -232,9 +232,9 @@ public function convertIndexDescription(TableSchema $schema, $row)
}
if ($type === Table::INDEX_INDEX) {
$existing = $schema->index($name);
$existing = $schema->getIndex($name);
} else {
$existing = $schema->constraint($name);
$existing = $schema->getConstraint($name);
}
$columns = [$row['column_name']];
@@ -328,7 +328,7 @@ protected function _convertOnClause($clause)
*/
public function columnSql(TableSchema $schema, $name)
{
$data = $schema->column($name);
$data = $schema->getColumn($name);
$out = $this->_driver->quoteIdentifier($name);
$typeMap = [
TableSchema::TYPE_TINYINTEGER => ' TINYINT',
@@ -430,7 +430,7 @@ public function addConstraintSql(TableSchema $schema)
$sql = [];
foreach ($schema->constraints() as $name) {
$constraint = $schema->constraint($name);
$constraint = $schema->getConstraint($name);
if ($constraint['type'] === Table::CONSTRAINT_FOREIGN) {
$tableName = $this->_driver->quoteIdentifier($schema->name());
$sql[] = sprintf($sqlPattern, $tableName, $this->constraintSql($schema, $name));
@@ -449,7 +449,7 @@ public function dropConstraintSql(TableSchema $schema)
$sql = [];
foreach ($schema->constraints() as $name) {
$constraint = $schema->constraint($name);
$constraint = $schema->getConstraint($name);
if ($constraint['type'] === Table::CONSTRAINT_FOREIGN) {
$tableName = $this->_driver->quoteIdentifier($schema->name());
$constraintName = $this->_driver->quoteIdentifier($name);
@@ -465,7 +465,7 @@ public function dropConstraintSql(TableSchema $schema)
*/
public function indexSql(TableSchema $schema, $name)
{
$data = $schema->index($name);
$data = $schema->getIndex($name);
$columns = array_map(
[$this->_driver, 'quoteIdentifier'],
$data['columns']
@@ -484,7 +484,7 @@ public function indexSql(TableSchema $schema, $name)
*/
public function constraintSql(TableSchema $schema, $name)
{
$data = $schema->constraint($name);
$data = $schema->getConstraint($name);
$out = 'CONSTRAINT ' . $this->_driver->quoteIdentifier($name);
if ($data['type'] === Table::CONSTRAINT_PRIMARY) {
$out = 'PRIMARY KEY';
@@ -553,7 +553,7 @@ public function truncateTableSql(TableSchema $schema)
// Restart identity sequences
$pk = $schema->primaryKey();
if (count($pk) === 1) {
$column = $schema->column($pk[0]);
$column = $schema->getColumn($pk[0]);
if (in_array($column['type'], ['integer', 'biginteger'])) {
$queries[] = sprintf(
"DBCC CHECKIDENT('%s', RESEED, 0)",
@@ -430,7 +430,7 @@ public function baseColumnType($column)
return $this->_columns[$column]['baseType'];
}
$type = $this->columnType($column);
$type = $this->getColumnType($column);
if ($type === null) {
return null;
@@ -33,7 +33,7 @@
* @method array getError($field)
* @method array setErrors(array $fields, $overwrite = false)
* @method array setError($field, $errors, $overwrite = false)
* @method $this setAccess(array $properties, $merge = false)
* @method $this setAccess($properties, $merge)
* @method bool isAccessible($property)
* @method $this setSource($source)
* @method array getSource()
@@ -138,6 +138,7 @@ public function extract(array $properties, $onlyDirty = false);
* When called with no arguments it will return whether or not there are any
* dirty property in the entity
*
* @deprecated 3.4.0 Use setDirty() and isDirty() instead.
* @param string|null $property the field to set or check status for
* @param null|bool $isDirty true means the property was changed, false means
* it was not changed and null will make the function return current state
@@ -179,6 +180,7 @@ public function isNew($new = null);
* When used as a setter, this method will return this entity instance for method
* chaining.
*
* @deprecated 3.4.0 Use setErrors() and getErrors() instead.
* @param string|array|null $field The field to get errors for.
* @param string|array|null $errors The errors to be set for $field
* @param bool $overwrite Whether or not to overwrite pre-existing errors for $field
@@ -193,6 +195,7 @@ public function errors($field = null, $errors = null, $overwrite = false);
* `$entity->accessible('*', true)` means that any property not specified already
* will be accessible by default.
*
* @deprecated 3.4.0 Use setAccess() and isAccessible() instead.
* @param string|array $property Either a single or list of properties to change its accessibility.
* @param bool|null $set true marks the property as accessible, false will
* mark it as protected.
@@ -70,7 +70,7 @@ protected function _buildPropertyMap($data, $options)
// Is a concrete column?
foreach (array_keys($data) as $prop) {
$columnType = $schema->columnType($prop);
$columnType = $schema->getColumnType($prop);
if ($columnType) {
$map[$prop] = function ($value, $entity) use ($columnType) {
return Type::build($columnType)->marshal($value);
@@ -216,7 +216,7 @@ public function one(array $data, array $options = [])
// dirty so we don't persist empty records.
foreach ($properties as $field => $value) {
if ($value instanceof EntityInterface) {
$entity->dirty($field, $value->dirty());
$entity->setDirty($field, $value->isDirty());
}
}
@@ -547,7 +547,7 @@ public function merge(EntityInterface $entity, array $data, array $options = [])
if (isset($options['accessibleFields'])) {
foreach ((array)$options['accessibleFields'] as $key => $value) {
$entity->accessible($key, $value);
$entity->setAccess($key, $value);
}
}
@@ -581,7 +581,7 @@ public function merge(EntityInterface $entity, array $data, array $options = [])
$properties[$key] = $value;
}
$entity->errors($errors);
$entity->setErrors($errors);
if (!isset($options['fields'])) {
$entity->set($properties);
@@ -785,7 +785,7 @@ protected function _mergeJoinData($original, $assoc, $value, $options)
$extra = [];
foreach ($original as $entity) {
// Mark joinData as accessible so we can marshal it properly.
$entity->accessible('_joinData', true);
$entity->setAccess('_joinData', true);
$joinData = $entity->get('_joinData');
if ($joinData && $joinData instanceof EntityInterface) {
@@ -460,7 +460,7 @@ protected function _getTypes($table, $fields)
}
foreach (array_intersect($fields, $schema->columns()) as $col) {
$typeName = $schema->columnType($col);
$typeName = $schema->getColumnType($col);
if (isset($typeMap[$typeName])) {
$types[$col] = $typeMap[$typeName];
}
@@ -117,7 +117,7 @@ public function __invoke(EntityInterface $entity, array $options)
if ($this->_options['allowNullableNulls']) {
$schema = $source->getSchema();
foreach ($this->_fields as $i => $field) {
if ($schema->column($field) && $schema->isNullable($field) && $entity->get($field) === null) {
if ($schema->getColumn($field) && $schema->isNullable($field) && $entity->get($field) === null) {
unset($bindingKey[$i], $this->_fields[$i]);
}
}
@@ -147,7 +147,7 @@ protected function _fieldsAreNull($entity, $source)
$nulls = 0;
$schema = $source->getSchema();
foreach ($this->_fields as $field) {
if ($schema->column($field) && $schema->isNullable($field) && $entity->get($field) === null) {
if ($schema->getColumn($field) && $schema->isNullable($field) && $entity->get($field) === null) {
$nulls++;
}
}
Oops, something went wrong.

0 comments on commit a38cb75

Please sign in to comment.
You can’t perform that action at this time.