svp/yii2-doctrine

There is no license information available for the latest version (dev-master) of this package.

Yii 2 extension wrapper to communicate with Doctrine 2.

dev-master 2017-03-16 13:27 UTC

This package is not auto-updated.

Last update: 2024-06-12 18:42:16 UTC


README

Yii 2 extension wrapper to communicate with Doctrine 2.

Installation

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

composer require svp/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.