Componette

Componette

download-cloud-line composer require martenb/nextras-orm-code-generator

Nextras ORM code generator

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
{
}
bar-chart-fill

Statistics

download-cloud-fill
551
star-fill
1
bug-fill
0
flashlight-fill
1.2y
price-tag-2-line

Badges

guide-fill

Dependencies

php (>=7.1)
nette/php-generator (^2.4 || ^3.0)
symfony/console (~3.3 || ^4.0)
Componette Componette felix@nette.org