No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
.gitignore
README.md
composer.json

README.md

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'
    entityExtends: 'App\Model\BaseEntity'
    repositoryExtends: 'App\Model\BaseRepository'
    mapperExtends: 'App\Model\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;

/**
 * @property int $id {primary}
 */
class Product extends BaseEntity
{
}

Repository %directory%/Product/ProductsRepository.php

<?php
namespace App\Model;

class ProductsRepository extends BaseRepository
{
	public static function getEntityClassNames(): array
	{
		return [Product::class];
	}
}

Maper %directory%/Product/ProductsMapper.php

<?php
namespace App\Model;

class ProductsMapper extends BaseMapper
{
}