-
Notifications
You must be signed in to change notification settings - Fork 2
Install from Scratch
Barry O'Donovan edited this page Jan 25, 2014
·
5 revisions
I have composer installed:
$ composer --version
Composer version b20021cc6aa113069e4223b78d0074a1fc7dd4e8 2014-01-14 16:22:09
Create a Laravel4 project:
composer create-project laravel/laravel test3
Edit composer.json:
"require": {
// ....,
"opensolutions/doctrine2bridge": "2.4.*"
},
// ....
"minimum-stability": "dev"
Then run:
composer update
Add the service providers to your Laravel application in app/config/app.php. In the 'providers' array add:
'Doctrine2Bridge\Doctrine2CacheBridgeServiceProvider',
'Doctrine2Bridge\Doctrine2BridgeServiceProvider',
You'll need to public and edit the configuration file:
./artisan config:publish opensolutions/doctrine2bridge
Start up your application via:
./artisan serve
And view it on http://localhost:8000/.
Add the following to the top of app/routes.php:
echo '<pre>';
var_dump( D2Cache::fetch( 'abcdef' ) );
var_dump( D2Cache::save( 'abcdef', 'qwerty' ) );
var_dump( D2Cache::fetch( 'abcdef' ) );
die();Refresh / local http://localhost:8000/ and expect to see:
bool(false)
bool(true)
string(6) "qwerty"
Create an XML schema:
mkdir -p doctrine/schema
cat cat >doctrine/schema/Entities.SampleEntity.dcm.xml <<ENDXML
<?xml version="1.0"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xsi="http://www.w3.org/2001/XMLSchema-instance" schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<entity name="Entities\SampleEntity" repository-class="Repositories\Sample">
<id name="id" type="integer">
<generator strategy="AUTO"/>
</id>
<field name="name" type="string" length="255" nullable="true"/>
</entity>
</doctrine-mapping>
ENDXML