We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Preparation: composer require cycle/orm
composer require cycle/orm
Simple script for reproduce problem:
<?php declare(strict_types=1); include 'vendor/autoload.php'; use Cycle\Database; use Cycle\Database\Config; use Cycle\ORM; use Cycle\Schema; $dbal = new Database\DatabaseManager( new Config\DatabaseConfig([ 'default' => 'default', 'databases' => [ 'default' => ['connection' => 'sqlite'] ], 'connections' => [ 'sqlite' => new Config\SQLiteDriverConfig( connection: new Config\SQLite\FileConnectionConfig(__DIR__ . '/test.db'), ), ] ]) ); $dbal->database()->execute('DROP TABLE IF EXISTS users'); $registry = new Schema\Registry($dbal); $entity = new Schema\Definition\Entity(); $entity ->setRole('user') ->setClass(User::class); $entity->getFields() // uncomment next line and run script again // ->set('text', (new Schema\Definition\Field())->setType('string')->setColumn('text')) ->set('id', (new Schema\Definition\Field())->setType('primary')->setColumn('id')->setPrimary(true)); $registry->register($entity); $registry->linkTable($entity, 'default', 'users'); $schema = (new Schema\Compiler())->compile($registry, [ new Schema\Generator\RenderTables(), new Schema\Generator\SyncTables(), ]); $orm = new ORM\ORM(new ORM\Factory($dbal), new ORM\Schema($schema)); $em = new ORM\EntityManager($orm); $em->persist(new User('1'))->run(); echo 'ROWS COUNT: ' . count($dbal->database('default')->query('SELECT * FROM users')->fetchAll()); class User { public function __construct( public string $text = '', ) { } }
Run script:
ROWS COUNT: 0
Enable 'text' mapping in entity (uncomment ->set() line) and run script again:
->set()
ROWS COUNT: 1
ORM 2.0.0 PHP 8.1
The text was updated successfully, but these errors were encountered:
tests for cycle#321
aa4b86c
tests for #321
f04ae1d
Fixed in 2.7.0
Sorry, something went wrong.
roxblnfk
Successfully merging a pull request may close this issue.
What happened?
Preparation:
composer require cycle/orm
Simple script for reproduce problem:
Run script:
Enable 'text' mapping in entity (uncomment
->set()
line) and run script again:Version
The text was updated successfully, but these errors were encountered: