liketomove/yii2-doctrine

Yii 2 extension wrapper to communicate with Doctrine 2.

Installs: 62

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 4

Type:yii-extension

v0.0.5 2019-07-14 11:21 UTC

This package is auto-updated.

Last update: 2024-05-14 21:55:43 UTC


README

Yii 2 extension wrapper to communicate with Doctrine 2.x.

Installation

You can add this library as a local, per-project dependency to your project using Composer:

composer require liketomove/yii2-doctrine

Usage

For connecting doctrine components insert in you config file

'components' => [
...
       'doctrine'  => [
            'class'    => 'yii\doctrine\components\DoctrineComponent',
            'isDev'    => true,            //for development 
            'driver'   => 'pdo_mysql',     //database driver
            'user'     => 'user',          //database user
            'password' => 'password',      //password
            'host'     => 'localhost',     
            'dbname'   => 'dbname',        //name database
            'entityPath' => [              //paths with you entity
                'backend/models',
                'frontend/models',
                'console/models',
                'common/models',
            ]
        ]
]

For using doctrine console add to you config file

'controllerMap' => [
        ....
        'doctrine' => [
            'class'     => 'yii\doctrine\console\DoctrineController',
        ]
    ]
]

and call ./yii doctrine, if you need transfer option use option -o=option.
For example :
--create table from entity ./yii orm:schema-tool:create
--update table from entity ./yii orm:schema-tool:update -o=--force
--create table from entity ./yii orm:schema-tool:drop -o=--dump-sql etc.