I've successfully implemented the Sonata Bundle, and did all that I have to do for the first 4 chapter of the official documentation. Thus, When trying to click on "add new' or 'list', I got this weird errror :
"
An exception has been thrown during the rendering of a template ("Notice: Array to string conversion in C:\Program Files (x86)\wamp\www\QNetworks\app\cache\dev\twig\eb\15\e380e4858b5d5bc113630bd4d095.php line 206") in SonataAdminBundle::standard_layout.html.twig at line 121.
"
Does anyone could help me to find out where does that come from ? (I mean why ? What should I do to fix it ? Because my tables are regular MySQL tables with strings in each fields, there is no reason why there should be an array commig out from one of these fields.
here are lines 114 to 131, line 121 is in red, i've noticed that if I get rid of {{uri}} variable, I don't have this error anymore. Does anyone knows where is this variable from and for ?
<div class="container-fluid">
{% if _breadcrumb is not empty or action is defined %}
<ul class="breadcrumb">
{% if _breadcrumb is empty %}
{% if action is defined %}
{% for label, uri in admin.breadcrumbs(action) %}
{% if not loop.last %}
<li><a href="">{{ label }}</a><span class="divider">/</span></li>
{% else %}
<li class="active">{{ label }}</li>
{% endif %}
{% endfor %}
{% endif %}
{% else %}
{{ _breadcrumb|raw }}
{% endif %}
</ul>
{% endif %}
I also want to add my admin class :
<?php
namespace QN\MainBundle\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;
class CategoryAdmin extends Admin
{
public function configureShowFields(ShowMapper $showMapper)
{
$showMapper
->add('name')
->add('level')
;
}
public function configureFormFields(FormMapper $formMapper)
{
$formMapper
->with('General')
->add('name', 'sonata_type_model', array(), array('edit' => 'list'))
->add('level')
->end()
;
}
public function configureListFields(ListMapper $listMapper)
{
$listMapper
->addIdentifier('name')
->add('level')
;
}
public function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('name')
->add('level')
;
}
}
Thank you !