Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lajosbencz/phalcon-model-generator
Generates annotated Phalcon\Model files from a database
https://github.com/lajosbencz/phalcon-model-generator
orm phalcon tools
Last synced: 21 days ago
JSON representation
Generates annotated Phalcon\Model files from a database
- Host: GitHub
- URL: https://github.com/lajosbencz/phalcon-model-generator
- Owner: lajosbencz
- Created: 2019-09-07T19:05:04.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2021-03-01T15:56:55.000Z (almost 4 years ago)
- Last Synced: 2024-09-14T02:49:45.941Z (4 months ago)
- Topics: orm, phalcon, tools
- Language: PHP
- Size: 32.2 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# phalcon-model-generator
Generates decorated Phalcon\Model files from a database
### Install
```bash
composer require lajosbencz/phalcon-model-generator
```### Use from terminal
Parameters are optional, first is path to global app config, second is root key of generator config inside the global.
```bash
vendor/bin/model-generate.php
vendor/bin/model-generate.php config.php
vendor/bin/model-generate.php config.php model_generator
```### Use from script
```php
[
'host' => '127.0.0.1',
'port' => 3306,
'username' => 'local',
'password' => 'local',
'dbname' => 'test_models',
],
'model_generator' => [
// path to namespace root (will be created)
'directory' => __DIR__,
// namespace extensible for models
'namespace' => 'TestModels',
// namespace for overwritten models
'namespace_auto' => 'TestModels\Auto',
// models will inherit from this base class
'base_model' => \Phalcon\Mvc\Model::class,
// views will inherit from this base class
'base_view' => \Phalcon\Mvc\Model::class,
// reusable relation parameter
'reusable' => false,
// logging: false for off, true for stdout, string for logging to stream
'log' => true,
// ignored tables (as they appear in database)
'blacklist' => [],
],
]);$g = new PhalconModelGenerator\Generator($config, 'model_generator');
$g->generate();```