indigophp / fuel-doctrine
Fuel Doctrine 2 integration
Installs: 16
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:fuel-package
Requires
- composer/installers: ~1.0
- doctrine/orm: ~2.4
- gedmo/doctrine-extensions: ~2.3
- indigophp/doctrine-extensions: dev-develop
- indigophp/fuel-core: dev-develop
- indigophp/fuel-dbal: dev-develop
- indigophp/fuel-dependency: dev-develop
Requires (Dev)
- codeception/codeception: ~2.0.0
- codeception/mockery-module: dev-master
- indigophp/codeception-fuel-module: dev-develop
This package is not auto-updated.
Last update: 2022-02-01 12:38:29 UTC
README
This package is a wrapper around doctrine/doctrine2 package.
Install
Via Composer
{ "require": { "indigophp/fuel-doctrine": "@stable" } }
Usage
$manager = \Doctrine\Manager::forge('default'); $em = $manager->getEntityManager();
Configuration
To make it work, you need the following doctrine
configuration.
'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',
You can also use the Setup
class to auto configure the Configuration
object.
'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
.
'auto_mapping' => false, 'dbal' => 'default', 'managers' => array( 'default' => array(), 'aditional' => array() ),
Note: This package uses 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:
oil r doctrine orm:schema-tool:drop --force oil r doctrine orm:schema-tool:create
General syntax:
oil r doctrine [command]
If you want to use a specific Manager instance put a DB env var before the command:
DB=my_doctrine_instance oil r doctrine [command]
Note: Make sure the doctrine
package is loaded in fuel otherwise the task will not work.
Testing
$ codecept run
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.