hi
how to extend the model for cmf page ?
I would like to add some properties on it, and don't find how to do it.
i try like this:
<?php
namespace St\AppBundle\Document;
use Symfony\Cmf\Bundle\ContentBundle\Model\StaticContentBase as CmfBaseStaticContent;
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCR;
/**
* @PHPCR\Document()
*/
class StaticContent extends CmfBaseStaticContent
{
/**
* @var
*/
protected $toto;
/**
* @return mixed
*/
public function getToto()
{
return $this->toto;
}
/**
* @param mixed $toto
*/
public function setToto($toto)
{
$this->toto = $toto;
}
/**
* @PHPCR\Id()
*/
protected $id;
/**
* @PHPCR\ParentDocument()
*/
protected $parent;
}
but i got this error: Property 'id' in 'St\AppBundle\Document\StaticContent' is declared twice.
found it !
just do like this
<?php
namespace St\AppBundle\Document;
use Sylius\Bundle\ContentBundle\Document\StaticContent as BaseStaticContent;
use Doctrine\ODM\PHPCR\Mapping\Annotations as PHPCR;
/**
* @PHPCR\Document()
*/
class StaticContent extends BaseStaticContent
{
/**
* @PHPCR\String()
*/
protected $metaTitle;
/**
* @return mixed
*/
public function getMetaTitle()
{
return $this->metaTitle;
}
/**
* @param mixed $metaTitle
*/
public function setMetaTitle($metaTitle)
{
$this->metaTitle = $metaTitle;
}
}
sylius_content:
driver: doctrine/phpcr-odm
resources:
static_content:
classes:
repository: Sylius\Bundle\ContentBundle\Doctrine\ODM\PHPCR\StaticContentRepository
model: St\AppBundle\Document\StaticContent
form:
default: St\AppBundle\Form\Type\StaticContentType
choice: Sylius\Bundle\ContentBundle\Form\Type\StaticContentChoiceType
cmf_content:
persistence:
phpcr:
content_basepath: /cms/pages
document_class: St\AppBundle\Document\StaticContent
default_template: "SyliusWebBundle:Frontend/StaticContent:show.html.twig"
and add it to the vue and don't forget the rdf-mappings
change your old properties in the DB if needed, if not, you can't see your pages
That's all !
Created a gist here https://gist.github.com/ylastapis/2462502f0cd58855f0c94a3f754e7369
Most helpful comment
Created a gist here https://gist.github.com/ylastapis/2462502f0cd58855f0c94a3f754e7369