alexssssss / ormmodel
Alexssssss ormmodel
v17.6.13
2026-06-22 16:13 UTC
Requires
- php: >=8.5.0
- ext-pdo: *
- aura/sql: ~3.0|~5.0|~6.0
- psr/event-dispatcher: ^1.0
- symfony/config: *
- symfony/intl: *
- symfony/validator: *
- symfony/yaml: *
Requires (Dev)
- friendsofphp/php-cs-fixer: *
- phpstan/phpstan-symfony: *
- phpunit/phpunit: *
- psr/container: ^1.0
- psr/log: ^1.0
- rector/rector: *
Suggests
- rdlowrey/auryn: Can be used to to autowire the services, version ~1.4
This package is auto-updated.
Last update: 2026-06-22 14:17:09 UTC
README
| Branch | GitLab CI Status |
|---|---|
| Master |
Install
config.php
<?php
define('DB_SERVER', '');
define('DB_USERNAME', '');
define('DB_PASSWORD', '');
db.php
<?php
/* @var $injector \Auryn\Injector */
$injector->alias('Aura\Sql\ExtendedPdoInterface', 'Aura\Sql\ExtendedPdo');
$injector->share('Aura\Sql\ExtendedPdoInterface');
$injector->share('Aura\Sql\ExtendedPdo');
$injector->share('Framework\PdoDatabase');
$injector->alias('Framework\DatabaseInterface', 'Framework\PdoDatabase');
$injector->share('Framework\Database');
if (defined('DB_SERVER') && defined('DB_USERNAME') && defined('DB_PASSWORD') && defined('DB_DATABASE')) {
$injector->delegate('Aura\Sql\ExtendedPdo', function () {
$connection = new \Aura\Sql\ExtendedPdo('mysql:host=' . DB_SERVER . ';dbname=' . DB_DATABASE, DB_USERNAME, DB_PASSWORD);
$connection->exec("SET NAMES 'utf8'");
return $connection;
});
}
ormmodel.yml
paths:
bootstrapFile: %%ORMMODEL_CONFIG_DIR%%/bootstrap.php
services: %%ORMMODEL_CONFIG_DIR%%/app/models/Service
modelNamespace: Model
index.php
<?php
require_once __DIR__.'/vender/autoload.php';
require_once __DIR__.'/config.php';
require_once __DIR__.'/dv.php';
$carModel = $injector->make('\Model\Service\Car');
$carModel->get();
Status checks
orm:status reports schema differences as errors or soft errors. Suppress all status
messages for a deliberate field mismatch with #[Orm\IgnoreStatus]:
use Alexssssss\OrmModel\Attribute as Orm;
class ExampleEntity extends AbstractEntity
{
#[Orm\IgnoreStatus]
public string $createdAt = '';
}
For a database column that intentionally has no entity property, add the repeatable attribute to the entity class:
#[Orm\IgnoreStatus('legacyColumn')]
class ExampleEntity extends AbstractEntity
{
}