2017 © Pedro PelĂĄez
 

fuel-package fuel-doctrine

Fuel Doctrine 2 integration

image

indigophp/fuel-doctrine

Fuel Doctrine 2 integration

  • Sunday, September 21, 2014
  • by mark.sagikazar
  • Repository
  • 0 Watchers
  • 0 Stars
  • 16 Installations
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Fuel Doctrine

Build Status Latest Stable Version Total Downloads License Dependency Status, (*1)

This package is a wrapper around doctrine/doctrine2 package., (*2)

Install

Via Composer, (*3)

``` json { "require": { "indigophp/fuel-doctrine": "@stable" } }, (*4)



## Usage ``` php $manager = \Doctrine\Manager::forge('default'); $em = $manager->getEntityManager();

Configuration

To make it work, you need the following doctrine configuration., (*5)

``` php 'dbal' => 'default', 'proxy_dir' => '/tmp', 'proxy_namespace' => 'PrOxYnAmEsPaCe', 'auto_generate_proxy_classes' => true, 'mappings' => array( 'mapping' => array( 'type' => 'xml', 'dir' => '/mypath', 'prefix' => 'MyPrefix', ), ), 'cache_driver' => 'array',, (*6)


You can also use the `Setup` class to auto configure the `Configuration` object. ``` php 'dbal' => 'default', 'auto_config' => true, 'dev_mode' => \Fuel::$env === \Fuel::DEVELOPMENT, 'proxy_dir' => '/tmp', 'cache_driver' => 'array',

Multiple managers

By default you have one manager (default). If you would like use multiple managers, you have to add a key managers to your doctrine config, and set your configurations there. You can also set global configurations in the config root. Make sure to set auto_mapping to false., (*7)

``` php 'auto_mapping' => false, 'dbal' => 'default', 'managers' => array( 'default' => array(), 'aditional' => array() ),, (*8)



**Note:** This package uses [indigophp/fuel-dbal](https://github.com/indigophp/fuel-dbal) for connections. Check the package documentation. ## Running `doctrine` commands Doctrine comes with a CLI tool by default, however it is a bit hard use it the official way (`cli-config.php` in the project root folder). So I wrapped it in an `oil` command. It is working, but it is still just a hack ("oil" and "r" or "refine" are just removed from the argument list), so use it with caution. Example: ``` bash oil r doctrine orm:schema-tool:drop --force oil r doctrine orm:schema-tool:create

General syntax: ``` bash oil r doctrine [command], (*9)


If you want to use a specific Manager instance put a DB env var before the command: ``` bash DB=my_doctrine_instance oil r doctrine [command]

Note: Make sure the doctrine package is loaded in fuel otherwise the task will not work., (*10)

Testing

bash $ codecept run, (*11)

Contributing

Please see CONTRIBUTING for details., (*12)

Credits

License

The MIT License (MIT). Please see License File for more information., (*13)

The Versions