.. What's up guys I've doing this project with Symfony 2.3.5 using FOSUSer Bundel and PUGXMultiUser Bundle and I wanted to use SonataAdmin Bundle but after configuration there was this problem about Menu that I could'nt see in the Dashboard .. Here is the configuration do you think I missed something !!
config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: @PokTVBundle/Resources/config/admin.yml }
framework:
#esi: ~
translator: { fallback: %locale% }
secret: %secret%
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_proxies: ~
session: ~
fragments: ~
http_method_override: true
# Twig Configuration
twig:
debug: %kernel.debug%
strict_variables: %kernel.debug%
# Assetic Configuration
assetic:
debug: %kernel.debug%
use_controller: false
bundles: [ ]
#java: /usr/bin/java
filters:
cssrewrite: ~
#closure:
# jar: %kernel.root_dir%/Resources/java/compiler.jar
#yui_css:
# jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
# Doctrine Configuration
doctrine:
dbal:
driver: %database_driver%
host: %database_host%
port: %database_port%
dbname: %database_name%
user: %database_user%
password: %database_password%
charset: UTF8
# if using pdo_sqlite as your database driver, add the path in parameters.yml
# e.g. database_path: %kernel.root_dir%/data/data.db3
# path: %database_path%
orm:
auto_generate_proxy_classes: %kernel.debug%
auto_mapping: true
# Swiftmailer Configuration
swiftmailer:
transport: %mailer_transport%
host: %mailer_host%
username: %mailer_user%
password: %mailer_password%
spool: { type: memory }
#FOSBundle
fos_user:
db_driver: orm # other valid values are 'mongodb', 'couchdb' and 'propel'
firewall_name: main
user_class: POKEtudiant\UserBundle\Entity\User
service:
mailer: fos_user.mailer.twig_swift
user_manager: pugx_user_manager
#registration:
#confirmation:
#enabled: true
#from_email:
#address: [email protected]
#sender_name: Elamrani Abou Elassad
#PUGXBundle
pugx_multi_user:
users:
etudiants:
entity:
class: POKEtudiant\UserBundle\Entity\Etudiant
# factory:
registration:
form:
type: POKEtudiant\UserBundle\Form\Type\RegistrationEtudiantFormType
name: fos_user_registration_form
validation_groups: [etudiant_grp, Default]
template: UserBundle:Registration:etudiants.form.html.twig
profile:
form:
type: POKEtudiant\UserBundle\Form\Type\ProfileEtudiantFormType
name: fos_user_profile_form
#validation_groups: [Profile, Default]
recruteurs:
entity:
class: POKEtudiant\UserBundle\Entity\Recruiter
registration:
form:
type: POKEtudiant\UserBundle\Form\Type\RegistrationRecruiterFormType
template: UserBundle:Registration:recruteurs.form.html.twig
profile:
form:
type: POKEtudiant\UserBundle\Form\Type\ProfileRecruiterFormType
#SonataBlock
sonata_block:
default_contexts: [cms]
blocks:
sonata.admin.block.admin_list:
contexts: [admin]
#sonata.admin_doctrine_orm.block.audit:
# contexts: [admin]
sonata.block.service.text:
sonata.block.service.rss:
# Some specific block from the SonataMediaBundle
#sonata.media.block.media:
#sonata.media.block.gallery:
#sonata.media.block.feature_media:
#SonataKnp
knp_menu:
twig: # use "twig: false" to disable the Twig extension and the TwigRenderer
template: knp_menu.html.twig
templating: false # if true, enables the helper for PHP templates
default_renderer: twig # The renderer to use, list is also available by default
#SonataAdmin
sonata_admin:
title: PokTv
#title_logo: /bundles/acmedemo/fancy_acme_logo.png
#security:
#handler: sonata.admin.security.handler.noop
#acl_user_manager: fos_user.user_manager
templates:
# default global templates
layout: SonataAdminBundle::standard_layout.html.twig
ajax: SonataAdminBundle::ajax_layout.html.twig
dashboard: SonataAdminBundle:Core:dashboard.html.twig
# default actions templates, should extend a global templates
list: SonataAdminBundle:CRUD:list.html.twig
show: SonataAdminBundle:CRUD:show.html.twig
edit: SonataAdminBundle:CRUD:edit.html.twig
history: SonataAdminBundle:CRUD:history.html.twig
preview: SonataAdminBundle:CRUD:preview.html.twig
delete: SonataAdminBundle:CRUD:delete.html.twig
batch: SonataAdminBundle:CRUD:list__batch.html.twig
batch_confirmation: SonataAdminBundle:CRUD:batch_confirmation.html.twig
# list related templates
inner_list_row: SonataAdminBundle:CRUD:list_inner_row.html.twig
base_list_field: SonataAdminBundle:CRUD:base_list_field.html.twig
# default values of block templates, they should extend the base_block template
list_block: SonataAdminBundle:Block:block_admin_list.html.twig
dashboard:
blocks:
- { position: left, type: sonata.admin.block.admin_list }
# display two dashboard blocks
#-
#position: left
#type: sonata.admin.block.admin_list
#settings:
#groups: [Movies]
#-
#position: right
#type: sonata.admin.block.admin_list
#settings:
#groups: [Series]
groups:
Movies:
items:
- sonata.admin.movies
Series:
items:
- sonata.admin.series
Foot:
items:
- sonata.admin.foot
sonata_doctrine_orm_admin:
# default value is null, so doctrine uses the value defined in the configuration
entity_manager:
templates:
form:
- SonataDoctrineORMAdminBundle:Form:form_admin_fields.html.twig
filter:
- SonataDoctrineORMAdminBundle:Form:filter_admin_fields.html.twig
types:
list:
array: SonataAdminBundle:CRUD:list_array.html.twig
boolean: SonataAdminBundle:CRUD:list_boolean.html.twig
date: SonataAdminBundle:CRUD:list_date.html.twig
time: SonataAdminBundle:CRUD:list_time.html.twig
datetime: SonataAdminBundle:CRUD:list_datetime.html.twig
text: SonataAdminBundle:CRUD:base_list_field.html.twig
trans: SonataAdminBundle:CRUD:list_trans.html.twig
string: SonataAdminBundle:CRUD:base_list_field.html.twig
smallint: SonataAdminBundle:CRUD:base_list_field.html.twig
bigint: SonataAdminBundle:CRUD:base_list_field.html.twig
integer: SonataAdminBundle:CRUD:base_list_field.html.twig
decimal: SonataAdminBundle:CRUD:base_list_field.html.twig
identifier: SonataAdminBundle:CRUD:base_list_field.html.twig
show:
array: SonataAdminBundle:CRUD:show_array.html.twig
boolean: SonataAdminBundle:CRUD:show_boolean.html.twig
date: SonataAdminBundle:CRUD:show_date.html.twig
time: SonataAdminBundle:CRUD:show_time.html.twig
datetime: SonataAdminBundle:CRUD:show_datetime.html.twig
text: SonataAdminBundle:CRUD:base_show_field.html.twig
trans: SonataAdminBundle:CRUD:show_trans.html.twig
string: SonataAdminBundle:CRUD:base_show_field.html.twig
smallint: SonataAdminBundle:CRUD:base_show_field.html.twig
bigint: SonataAdminBundle:CRUD:base_show_field.html.twig
integer: SonataAdminBundle:CRUD:base_show_field.html.twig
decimal: SonataAdminBundle:CRUD:base_show_field.html.twig
admin.yml
services:
sonata.admin.movies:
class: POKEtudiant\PokTVBundle\Admin\MoviesAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "Movies", label: "Movies", show_in_dashboard: "true" }
arguments:
- ~
- POKEtudiant\PokTVBundle\Entity\Movies
- ~
sonata.admin.series:
class: POKEtudiant\PokTVBundle\Admin\SeriesAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "Series", label: "Series" }
arguments:
- ~
- POKEtudiant\PokTVBundle\Entity\Series
- ~
sonata.admin.foot:
class: POKEtudiant\PokTVBundle\Admin\FootAdmin
tags:
- { name: sonata.admin, manager_type: orm, group: "Foot", label: "Foot" }
arguments:
- ~
- POKEtudiant\PokTVBundle\Entity\Foot
- ~
app/config/routing.yml
#PokTV Bundle
pok_tv:
resource: "@PokTVBundle/Resources/config/routing.yml"
prefix: /PokTV
#User Bundle
user:
resource: "@UserBundle/Resources/config/routing.yml"
prefix: /
#Sonata Admin
admin:
resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
prefix: /admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin
appKernel (registerBundles)
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
new Symfony\Bundle\TwigBundle\TwigBundle(),
new Symfony\Bundle\MonologBundle\MonologBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
new FOS\UserBundle\FOSUserBundle(),
new PUGX\MultiUserBundle\PUGXMultiUserBundle(),
new Sonata\BlockBundle\SonataBlockBundle(),
new Sonata\jQueryBundle\SonatajQueryBundle(),
new Knp\Bundle\MenuBundle\KnpMenuBundle(),
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
new Sonata\AdminBundle\SonataAdminBundle(),
new POKEtudiant\UserBundle\UserBundle(),
new POKEtudiant\PokTVBundle\PokTVBundle(),
);
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Acme\DemoBundle\AcmeDemoBundle();
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
return $bundles;
}
It's looks like you have not configured ROLE_SONATA_ADMIN for your user; Or just map it in security.yml, like this
security:
role_hierarchy:
ROLE_ADMIN: [ROLE_USER, ROLE_SONATA_ADMIN]
After your user will have this role, the menu must be displayed;
Check your twig file to see which block is still being used. The sonata blocks section only has sonata.admin.block.admin_list which should be loaded with the defaults.
You can get error feedback by enabling filters: [sorry this is my first resonse. How do you get the formatting to work?] sonata_block: default_contexts: [cms] exception: default: filter: debug_only renderer: throw filters: debug_only: sonata.block.exception.filter.debug_only ignore_block_exception: sonata.block.exception.filter.ignore_block_exception keep_all: sonata.block.exception.filter.keep_all keep_none: sonata.block.exception.filter.keep_none renderers: inline: sonata.block.exception.renderer.inline inline_debug: sonata.block.exception.renderer.inline_debug throw: sonata.block.exception.renderer.throw
Then add this line directly under the admin block: blocks: sonata.admin.block.admin_list: contexts: [admin] exception: { filter: keep_all, renderer: inline }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With