First Admin:
class ContentContactInformationAdmin extends Admin
{
protected $baseRouteName = 'bobbiq_core_test_content_contact_information';
protected $baseRoutePattern = 'bobbiq/iq/test/content-contact-information';
public function getExportFormats()
{
return array();
}
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('id', 'text')
->addIdentifier('title', 'text')
;
}
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->with('form.group_general')
->add('name', 'text')
->add('title', 'text')
->add('body', 'textarea', array('required' => false))
->end()
;
}
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('title', 'doctrine_phpcr_string')
->add('name', 'doctrine_phpcr_nodename')
;
}
}
Second Admin:
class ContentContactPersonAdmin extends Admin
{
protected $baseRouteName = 'bobbiq_core_test_content_contact_person';
protected $baseRoutePattern = 'bobbiq/iq/test/content-contact-person';
public function getExportFormats()
{
return array();
}
protected function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('id', 'text')
->addIdentifier('title', 'text')
;
}
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->with('form.group_general')
->add('name', 'text')
->add('title', 'text')
->add('body', 'textarea', array('required' => false))
->end()
;
}
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('title', 'doctrine_phpcr_string')
->add('name', 'doctrine_phpcr_nodename')
;
}
}
Both configs:
services:
sonata.admin.content_person:
class: Bobb\IQ\Bundle\CoreBundle\Tests\Resources\Admin\ContentContactPersonAdmin
tags:
- { name: sonata.admin, manager_type: doctrine_phpcr, label_catalogue: BobbiqCoreBundle, group: dashboard.test, label: dashboard.label_content_contact_person, label_translator_strategy: sonata.admin.label.strategy.underscore}
arguments:
- ~
- Bobb\IQ\Bundle\CoreBundle\Tests\Resources\Document\ContentContactPerson
- SonataAdminBundle:CRUD
calls:
- [ setTranslationDomain, [BobbiqCoreBundle]]
- [ setRouteBuilder, [@sonata.admin.route.path_info_slashes]]
- [ setRootPath, [/test/content]]
sonata.admin.content_information:
class: Bobb\IQ\Bundle\CoreBundle\Tests\Resources\Admin\ContentContactInformationAdmin
tags:
- { name: sonata.admin, manager_type: doctrine_phpcr, label_catalogue: BobbiqCoreBundle, group: dashboard.test, label: dashboard.label_content_contact_information, label_translator_strategy: sonata.admin.label.strategy.underscore}
arguments:
- ~
- Bobb\IQ\Bundle\CoreBundle\Tests\Resources\Document\ContentContactInformation
- SonataAdminBundle:CRUD
calls:
- [ setTranslationDomain, [BobbiqCoreBundle]]
- [ setRouteBuilder, [@sonata.admin.route.path_info_slashes]]
- [ setRootPath, [/test/content]]
sonata_admin:
extensions:
bobbiq_core.admin_extension.information:
implements:
- Bobb\IQ\Bundle\CoreBundle\ContactInformationAware
bobbiq_core.admin_extension.person:
implements:
- Bobb\IQ\Bundle\CoreBundle\ContactPersonAware
First Document:
class ContentContactInformation extends ContentBase implements
ContactInformationAware
{
/**
* @var ContactInformation
* @PHPCRODM\Child
*/
protected $contactInformation;
/**
* @param ContactInformation $contactInformation
*/
public function setContactInformation(ContactInformation $contactInformation)
{
$this->contactInformation = $contactInformation;
}
/**
* @return ContactInformation
*/
public function getContactInformation()
{
return $this->contactInformation;
}
}
Second Document:
class ContentContactPerson extends ContentBase implements
ContactPersonAware
{
/**
* @PHPCRODM\Child
*/
protected $contactPerson;
/**
* {@inheritDoc}
*/
public function setContactPerson(ContactPerson $contactPerson)
{
$this->contactPerson = $contactPerson;
}
/**
* {@inheritDoc}
*/
public function getContactPerson()
{
return $this->contactPerson;
}
}
BaseClass:
/**
* @PHPCRODM\MappedSuperclass(referenceable=true)
* @ORM\MappedSuperclass
*/
abstract class ContentBase
{
/**
* @PHPCRODM\Id
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @PHPCRODM\Node
*/
protected $node;
/**
* @PHPCRODM\ParentDocument
*/
protected $parentDocument;
/**
* @PHPCRODM\Nodename
*/
protected $name;
/**
* @PHPCRODM\String
* @ORM\Column(type="string")
*/
protected $title;
/**
* @PHPCRODM\String
* @ORM\Column(type="text")
*/
protected $body;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* Gets the underlying PHPCR node of this content.
*
* @return NodeInterface
*/
public function getNode()
{
return $this->node;
}
/**
* Sets the parent document.
*
* @param object $parent The parent document.
* @return $this
*/
public function setParentDocument($parent)
{
$this->parentDocument = $parent;
return $this;
}
/**
* Gets the parent document.
*
* @return object
*/
public function getParentDocument()
{
return $this->parentDocument;
}
/**
* Sets the document name.
*
* @param string $name
* @return $this
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Gets the document name.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* @param string $title
* @return $this
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* @return string
*/
public function getBody()
{
return $this->body;
}
/**
* @param string $body
* @return $this
*/
public function setBody($body)
{
$this->body = $body;
return $this;
}
}
With that i got and Exception for having a circular think in routing.