14.06.2013 Views

The Symfony CMF Book

The Symfony CMF Book

The Symfony CMF Book

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Listing 11-6<br />

Listing 11-7<br />

Listing 11-8<br />

Listing 11-9<br />

Listing 11-10<br />

Add the following line to the registerBundles() method of the AppKernel:<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

// app/AppKernel.php<br />

// ...<br />

public function registerBundles()<br />

{<br />

$bundles = array(<br />

// ...<br />

new Doctrine\Bundle\PHPCRBundle\DoctrinePHPCRBundle(),<br />

);<br />

}<br />

// ...<br />

Add the following line to your autoload.php file, immediately after the last<br />

AnnotationRegistry::registerFile line:<br />

1<br />

2<br />

3<br />

4<br />

5<br />

// app/autoload.php<br />

// ...<br />

AnnotationRegistry::registerFile(__DIR__.'/../vendor/doctrine/phpcr-odm/lib/Doctrine/ODM/<br />

PHPCR/Mapping/Annotations/DoctrineAnnotations.php');<br />

// ...<br />

Create the database schema and register the PHPCR node types using the following console commands:<br />

1<br />

2<br />

$ php app/console doctrine:phpcr:init:dbal<br />

$ php app/console doctrine:phpcr:repository:init<br />

Now you should have a number of tables in your MySQL database with the phpcr_ prefix.<br />

Install the needed <strong>Symfony</strong> <strong>CMF</strong> Components<br />

To install the BlockBundle, run:<br />

1 $ php composer.phar require symfony-cmf/block-bundle:master<br />

Add the following lines to AppKernel:<br />

1<br />

2<br />

3<br />

4<br />

5<br />

6<br />

7<br />

8<br />

9<br />

10<br />

11<br />

12<br />

13<br />

// app/AppKernel.php<br />

// ...<br />

public function registerBundles()<br />

{<br />

$bundles = array(<br />

// ...<br />

new Sonata\BlockBundle\SonataBlockBundle(),<br />

new <strong>Symfony</strong>\Cmf\Bundle\BlockBundle\CmfBlockBundle(),<br />

);<br />

}<br />

// ...<br />

PDF brought to you by<br />

generated on June 13, 2013<br />

Chapter 11: Using the BlockBundle and ContentBundle with PHPCR | 46

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!