in /vendor/bundles/Sonata/NewsBundle/Resources/config/doctrine/Post.orm.xml.skeleton I add my custom field
<?xml version="1.0" encoding="utf-8"?>
<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 http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<!--
This file has been generated by the EasyExtends bundle ( http://sonata-project.org/easy-extends )
References :
xsd : https://github.com/doctrine/doctrine2/blob/master/doctrine-mapping.xsd
xml mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/xml-mapping/en
association mapping : http://www.doctrine-project.org/projects/orm/2.0/docs/reference/association-mapping/en
-->
<entity
name="Application\Sonata\NewsBundle\Entity\Post"
table="news__post"
repository-class="Application\Sonata\NewsBundle\Entity\PostRepository">
<id name="id" type="integer" column="id">
<generator strategy="AUTO"/>
</id>
<one-to-one field="podcast" target-entity="RadioSolution\PodcastBundle\Entity\Podcast" inversed-by="Application\Sonata\NewsBundle\Entity\Post">
<join-column name="podcast_id" referenced-column-name="id" />
</one-to-one>
</entity>
</doctrine-mapping>
<?php
namespace Application\Sonata\NewsBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;
use Sonata\AdminBundle\Form\FormMapper;
use Sonata\AdminBundle\Datagrid\DatagridMapper;
use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;
use Sonata\FormatterBundle\Formatter\Pool as FormatterPool;
use Sonata\NewsBundle\Admin\PostAdmin as BaseAdmin;
use Knp\Menu\ItemInterface as MenuItemInterface;
use Application\Sonata\NewsBundle\Entity\Comment;
class PostAdmin extends BaseAdmin
{
/**
* {@inheritdoc}
*/
protected function configureFormFields(FormMapper $formMapper)
{
$formMapper
->with('General')
->add('enabled', null, array('required' => false))
->add('author', 'sonata_type_model', array(), array('edit' => 'list'))
->add('category', 'sonata_type_model', array(), array('edit' => 'list'))
->add('title')
->add('abstract')
->add('contentFormatter', 'sonata_formatter_type_selector', array(
'source' => 'rawContent',
'target' => 'content'
))
->add('rawContent','textarea', array('attr' => array('class' => 'tinymce', 'tinymce'=>'{"theme":"medium"}')))
->end()
->with('podcast')
->add('podcast','sonata_type_model', array('required' => false))
->end()
->with('Tags')
->add('tags', 'sonata_type_model', array('expanded' => true))
->end()
->with('Options')
->add('publicationDateStart')
->add('commentsCloseAt')
->add('commentsEnabled', null, array('required' => false))
->add('commentsDefaultStatus', 'choice', array('choices' => Comment::getStatusList(), 'expanded' => true))
->end()
;
}
}
services:
sonata.news.admin.post:
class: Application\Sonata\NewsBundle\Admin\PostAdmin
tags:
- { name: sonata.admin,manager_type: orm, group:"sonata_blog", label:"posts", label_catalogue:"%sonata.news.admin.post.translation_domain%", label_translator_strategy:"sonata.admin.label.strategy.underscore"}
arguments: [null,Application\Sonata\NewsBundle\Entity\Post, SonataAdminBundle:CRUD]
An exception has been thrown during the rendering of a template ("unable to find the routesonata.news.admin.post|sonata.news.admin.comment.list
") in SonataAdminBundle::standard_layout.html.twig at line 18.