Skip to content

Composer update to latest #4

New issue

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
],
"require": {
"ext-pdo": "*",
"compositephp/db": "0.4.2",
"cycle/orm": "2.6",
"cycle/annotated": "3.4",
"cycle/entity-behavior": "1.2",
"doctrine/orm": "2.17.2",
"illuminate/database": "10.38.2",
"vlucas/phpdotenv": "5.6.0",
"symfony/cache": "7.0.0",
"phpfui/orm": "^1.7"
"compositephp/db": "^0.5",
"cycle/orm": "^2.10",
"cycle/annotated": "^4.3",
"cycle/entity-behavior": "^1.2",
"doctrine/orm": "^3.0",
"illuminate/database": "^12.0",
"vlucas/phpdotenv": "^5.6.0",
"symfony/cache": "^7.0",
"phpfui/orm": "^2.0"
}
}
27 changes: 18 additions & 9 deletions src/PHPFUIORM/Record/Definition/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,27 @@ abstract class Users extends \PHPFUI\ORM\Record
{
protected static bool $autoIncrement = true;

/** @var array<string, array<mixed>> */
protected static array $fields = [
// MYSQL_TYPE, PHP_TYPE, LENGTH, ALLOWS_NULL, DEFAULT
'age' => ['int', 'int', 0, false, ],
'created_at' => ['timestamp', 'string', 20, false, NULL, ],
'id' => ['int', 'int', 0, false, ],
'microtime' => ['float', 'float', 0, false, ],
'name' => ['varchar(255)', 'string', 255, false, ],
];
/** @var array<string, \PHPFUI\ORM\FieldDefinition> */
protected static array $fields = [];

/** @var array<string> */
protected static array $primaryKeys = ['id', ];

protected static string $table = 'users';

public function initFieldDefinitions() : static
{
if (! \count(static::$fields))
{
static::$fields = [
'age' => new \PHPFUI\ORM\FieldDefinition('int', 'int', 0, false, ),
'created_at' => new \PHPFUI\ORM\FieldDefinition('timestamp', 'string', 20, false, NULL, ),
'id' => new \PHPFUI\ORM\FieldDefinition('int', 'int', 0, false, ),
'microtime' => new \PHPFUI\ORM\FieldDefinition('float', 'float', 0, false, ),
'name' => new \PHPFUI\ORM\FieldDefinition('varchar(255)', 'string', 255, false, ),
];
}

return $this;
}
}
6 changes: 4 additions & 2 deletions src/test-cycle.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@

$finder = (new \Symfony\Component\Finder\Finder())->files()->in([__DIR__ . '/Cycle']); // __DIR__ here is folder with entities
$classLocator = new \Spiral\Tokenizer\ClassLocator($finder);
$tokenizer = new \Cycle\Annotated\Locator\TokenizerEmbeddingLocator($classLocator);
$entityLocator = new \Cycle\Annotated\Locator\TokenizerEntityLocator($classLocator);

$schema = (new Schema\Compiler())->compile(new Schema\Registry($dbal), [
new Schema\Generator\ResetTables(), // re-declared table schemas (remove columns)
new Annotated\Embeddings($classLocator), // register embeddable entities
new Annotated\Entities($classLocator), // register annotated entities
new Annotated\Embeddings($tokenizer), // register embeddable entities
new Annotated\Entities($entityLocator), // register annotated entities
new Annotated\TableInheritance(), // register STI/JTI
new Annotated\MergeColumns(), // add @Table column declarations
new Schema\Generator\GenerateRelations(), // generate entity relations
Expand Down