Download the PHP package aspendigital/fuel-doctrine2 without Composer
On this page you can find all versions of the php package aspendigital/fuel-doctrine2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aspendigital/fuel-doctrine2
More information about aspendigital/fuel-doctrine2
Files in aspendigital/fuel-doctrine2
Package fuel-doctrine2
Short Description Doctrine2 integration with FuelPHP
License LGPL-2.1+
Informations about the package fuel-doctrine2
FuelPHP Doctrine 2 Package
About
This package contains a basic wrapper around the Doctrine 2 ORM functionality for access using the FuelPHP framework. It is distributed under the same LGPL license as Doctrine itself.
How to install
You can install this package with Composer. So first you'll need Composer, which can be found at http://getcomposer.org/
- If your application doesn't have a
composer.json
file please create it. -
Add an additional
require
- Install with
composer install
Quick start
Configuration is simple and involves adding additional Doctrine configuration options to your FuelPHP db.php config.
To get running quickly, there are only three required settings:
in app/config/db.php
add
and of course configure database settings (user, password etc) as you would normally do for Fuel.
How to use
when you've configured your application, to get an EntityManager, use the following code:
Or you can check the versions of the Doctrine components:
Typical configuration example
Using the cascading configuration files that FuelPHP offers, a typical configuration looks something like:
app/config/db.php
:
app/config/development/db.php
:
app/config/production/db.php
:
In the development environment, we use the default array cache (nothing is saved permanently) and enable profiling. In the production environment, we leave profiling off and use APC (or some other caching solution).
Connection setting override
If for some reason you need to override Doctrine2 settings on a connection-by-connection basis, include a doctrine2
key in your connection settings:
Configuration options
Refer to the Doctrine 2 documentation
proxy_dir
: the directory containing your proxy classesproxy_namespace
: the namespace where the proxy classes residemetadata_path
: the directory containing your metadatametadata_driver
: options are 'annotation' (default), 'php', 'simplified_xml', 'simplified_yaml', 'xml', 'yaml'auto_generate_proxy_classes
: true/false for whether Doctrine should generate proxy classes for entities it loadscache_driver
: options are 'array' (default), 'apc', 'xcache', 'wincache', 'zend'init_callback
: A 'callable' value which will be run when the EntityManager is instantiated. This can be used to set up custom DBAL types or otherwise customize the environment.
app/classes/myclass.php
:
On connection:
driver
: we try to guess the DBAL driver to load to connect to your database, but you may have to set this if the guessing doesn't work for you- Consult the Doctrine DBAL documentation for other DBAL-specific options
For FuelPHP options, refer to Fuel database configuration
type
charset
profiling
enable_cache
: in our case, there is always some caching taking place, but it's only temporary unless you've changed thecache_driver
settingconnection.persistent
connection.compress
Profiling
No configuration is required beyond enabling profiling for your connection. Queries sent through Doctrine ORM and directly through DBAL will automatically appear in the Fuel profiler.
Doctrine 2 ORM
Doctrine 2 is an object-relational mapper (ORM) for PHP 5.3.2+ that provides transparent persistence for PHP objects. It sits on top of a powerful database abstraction layer (DBAL). One of its key features is the option to write database queries in a proprietary object oriented SQL dialect called Doctrine Query Language (DQL), inspired by Hibernates HQL. This provides developers with a powerful alternative to SQL that maintains flexibility without requiring unnecessary code duplication.