martenb / nextras-orm-code-generator
This package is abandoned and no longer maintained.
The author suggests using the adbros/worker package instead.
Console entity, repository and mapper generator for Nextras/ORM
v0.2
2019-09-27 12:38 UTC
Requires
- php: >=7.1
- nette/php-generator: ^2.4 || ^3.0
- nextras/orm: ^3.0
- symfony/console: ~3.3 || ^4.0
Requires (Dev)
- nette/di: ^2.4.1 || ^3.0
- ninjify/nunjuck: ^0.2.1
- ninjify/qa: ^0.9
This package is auto-updated.
Last update: 2020-05-21 09:53:23 UTC
README
Installation
composer require martenb/nextras-orm-code-generator:dev-master --dev
Configuration
extensions: ormGenerator: MartenB\Nextras\ORM\DI\Extension
Optional configuration
ormGenerator: directory: '%appDir%/Model/Orm' namespace: 'App\Model\Orm' entityExtends: 'App\Model\Orm\BaseEntity' repositoryExtends: 'App\Model\Orm\BaseRepository' mapperExtends: 'App\Model\Orm\BaseMapper'
Usage
php bin/console orm:generator Product Products
This command creates entity, repository and mapper in %directory%/Product
.
Entity %directory%/Product/Product.php
<?php namespace App\Model\Orm\Product; /** * @property int $id {primary} */ class Product extends BaseEntity { }
Repository %directory%/Product/ProductsRepository.php
<?php namespace App\Model\Orm\Product; class ProductsRepository extends BaseRepository { public static function getEntityClassNames(): array { return [Product::class]; } }
Maper %directory%/Product/ProductsMapper.php
<?php namespace App\Model\Orm\Product; class ProductsMapper extends BaseMapper { }