Cakephp 4.x api seems changed a lot
harikt opened this issue · 1 comments
harikt commented
Summary
Cakephp 4.x version api has changed. Digging into I noticed $schema = $table->schema();
is $schema = $table->getSchema();
, and the schema api also changed.
$pk = $schema->primaryKey();
changed to $pk = $schema->getPrimaryKey();
Also there are more changes that may need to be looked into. I don't know what is equivalent to $schema->columns()
etc. If I get a chance to dig deeper, will send a PR.
Versions
Version | |
---|---|
PHP | 7.3.9 |
fzaninotto/faker |
v1.9.1 |
Self-enclosed code snippet for reproduction
$generator = FakerFactory::create();
$populator = new \Faker\ORM\CakePHP\Populator($generator);
$populator->addEntity('Posts', 10);
$populator->execute();
Expected output
Successfully run the seed generation.
Actual output
In Table.php line 2496:
[BadMethodCallException]
Unknown method "schema" called on Blog\Model\Table\PostsTable
Exception trace:
at /projects/harikt/mascot-basic/vendor/cakephp/orm/Table.php:2496
Cake\ORM\Table->__call() at /projects/harikt/mascot-basic/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/EntityPopulator.php:53
Faker\ORM\CakePHP\EntityPopulator->guessColumnFormatters() at /projects/harikt/mascot-basic/vendor/fzaninotto/faker/src/Faker/ORM/CakePHP/Populator.php:77
Faker\ORM\CakePHP\Populator->addEntity() at /projects/harikt/mascot-basic/config/Seeds/PostSeeder.php:21
PostSeeder->run() at /projects/harikt/mascot-basic/vendor/robmorgan/phinx/src/Phinx/Migration/Manager/Environment.php:139
Phinx\Migration\Manager\Environment->executeSeed() at /projects/harikt/mascot-basic/vendor/robmorgan/phinx/src/Phinx/Migration/Manager.php:405
Phinx\Migration\Manager->executeSeed() at /projects/harikt/mascot-basic/vendor/robmorgan/phinx/src/Phinx/Migration/Manager.php:547
Phinx\Migration\Manager->seed() at /projects/harikt/mascot-basic/vendor/robmorgan/phinx/src/Phinx/Console/Command/SeedRun.php:103
Phinx\Console\Command\SeedRun->execute() at /projects/harikt/mascot-basic/vendor/cakephp/migrations/src/Command/CommandTrait.php:36
Migrations\Command\Seed->parentExecute() at /projects/harikt/mascot-basic/vendor/cakephp/migrations/src/Command/Seed.php:73
Migrations\Command\Seed->execute() at /projects/harikt/mascot-basic/vendor/symfony/console/Command/Command.php:255
Symfony\Component\Console\Command\Command->run() at /projects/harikt/mascot-basic/vendor/symfony/console/Application.php:1029
Symfony\Component\Console\Application->doRunCommand() at /projects/harikt/mascot-basic/vendor/symfony/console/Application.php:272
Symfony\Component\Console\Application->doRun() at /projects/harikt/mascot-basic/vendor/symfony/console/Application.php:148
Symfony\Component\Console\Application->run() at /projects/harikt/mascot-basic/bin/console:16
pimjansen commented
Faker 1.x is not compatible i guess and further support for ORM is dropped from 2.0. So in that case i think a custom provider should be build