Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

Commit

Permalink
Avoid deprecation warning in newer CakePHP version
Browse files Browse the repository at this point in the history
This will avoid deprecation warnings by accessing
`getColumn` if the method exists. Otherwise access the old `column` method.

Solve #1616
  • Loading branch information
icanhazstring authored and pimjansen committed Aug 27, 2019
1 parent 768354c commit a76ada1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Faker/ORM/CakePHP/ColumnTypeGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ public function guessFormat($column, $table)
return $generator->uuid();
};
case 'string':
$columnData = $schema->column($column);
if (method_exists($schema, 'getColumn')) {
$columnData = $schema->getColumn($column);
} else {
$columnData = $schema->column($column);
}
$length = $columnData['length'];
return function () use ($generator, $length) {
return $generator->text($length);
Expand Down

0 comments on commit a76ada1

Please sign in to comment.