PHP code example of lajosbencz / phalcon-model-generator
1. Go to this page and download the library: Download lajosbencz/phalcon-model-generator library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
lajosbencz / phalcon-model-generator example snippets
ig = new \Phalcon\Config([
'database' => [
'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();