symfony-cmf / simple-cms-bundle

UNMAINTAINED - A more-than-simple cms based on the cmf components
http://cmf.symfony.com/
49 stars 45 forks source link

How to extend the Page Class. #111

Closed lowki closed 10 years ago

lowki commented 10 years ago

I'm trying to extend the default SimpleCmsBundle Page Class, but I have a MappingException error. Here my Product Class extending Page Class.

<?php

namespace Lowki\MainBundle\Document;

use Doctrine\ODM\PHPCR\Mapping\Annotations\Document;
use Symfony\Cmf\Bundle\SimpleCmsBundle\Doctrine\Phpcr\Page as BasePage;

/**
 * {@inheritDoc}
 */
class Product extends BasePage
{
    public $node;
}

What am I doing wrong?

dbu commented 10 years ago

do you have an xml / yml mapping for phpcr-odm and configured phpcr-odm to find mappings with doctrine_phpcr.odm.auto_mapping: true or explicitly list the bundle? the easiest for your own projects documents is to use annotations mapping. see for example https://github.com/symfony-cmf/cmf-sandbox/blob/master/src/Sandbox/MainBundle/Document/DemoTemplateContent.php

lowki commented 10 years ago

That was what I did, but an error with another orm entity was messing up everything. Thank you David.