stepapo/generator

一个库,用于生成具有基本结构和 Nextras ORM 模型文件的空 Nette Presenters、Components 和 Services。

0.1.5 2023-04-20 10:45 UTC

This package is auto-updated.

Last update: 2024-09-08 17:07:59 UTC


README

用于生成具有基本结构的空 Nette Presenters、Components 和 Nextras ORM 模型文件的工具。

用法

展示器(Presenter)

$options = getopt(null, ['appNamespace:', 'appDir:', 'name:', 'module:']);

$generator = new Stepapo\Generator\Generator(
	appNamespace: $options['appNamespace'] ?? 'App',
	appDir: __DIR__ . '/../' . ($options['appDir'] ?? 'app'),
);

$generator->createPresenter(
	name: $options['name'],
	module: $options['module'] ?? null,
);

组件(Component)

$options = getopt(null, ['appNamespace:', 'appDir:', 'name:', 'module:', 'type:', 'entityName:', 'withTemplateName:']);

$generator = new Stepapo\Generator\Generator(
	appNamespace: $options['appNamespace'] ?? 'App',
	appDir: __DIR__ . '/../' . ($options['appDir'] ?? 'app'),
);

$generator->createComponent(
	name: $options['name'], 
	module: $options['module'] ?? null, 
	entityName: $options['entityName'] ?? null, 
	withTemplateName: $options['withTemplateName'] ?? false,
	type: $options['type'] ?? null,
);

模型(Model)

$options = getopt(null, ['appNamespace:', 'appDir:', 'name:', 'module:', 'withConventions:']);

$generator = new Stepapo\Generator\Generator(
	appNamespace: $options['appNamespace'] ?? 'App',
	appDir: __DIR__ . '/../' . ($options['appDir'] ?? 'app'),
);

$generator->createModel(
	name: $options['name'], 
	module: $options['module'] ?? null, 
	withConventions: $options['withConventions'] ?? false,
);

服务(Service)

$options = getopt(null, ['appNamespace:', 'appDir:', 'name:', 'module:']);

$generator = new Stepapo\Generator\Generator(
	appNamespace: $options['appNamespace'] ?? 'App',
	appDir: __DIR__ . '/../' . ($options['appDir'] ?? 'app'),
);

$generator->createService(
	name: $options['name'],
	module: $options['module'] ?? null,
);