symfony 4 changes are not taken into account - php
I have migrated a symfony 4 application from the production server to the server that I am using for tests, bothe servers are on wampserver . the application works fine on the test server but the problem is that when I make changes, they are not taken into account. every time I change a twig file the changes dont show up. I think that it is using the prod and dev variables but I am new in Symfony I am not sure how it works .apparently now the server is on prod mode and I want to change it to dev mode .
the code for the vhosts file is
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
SetEnv APP_ENV prod
SetEnv APP_SECRET b33c77e602bc1bafb66f673c1e31aca3
SetEnv DATABASE_URL mysql://root#127.0.0.1:3306/gpac
DocumentRoot "${INSTALL_DIR}/www/gpac/public"
<Directory "${INSTALL_DIR}/www/gpac/public/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
the public/index.php is
<?php
use App\Kernel;
use Symfony\Component\Debug\Debug;
use Symfony\Component\Dotenv\Dotenv;
use Symfony\Component\HttpFoundation\Request;
require __DIR__.'/../vendor/autoload.php';
// The check is to ensure we don't use .env in production
if (!isset($_SERVER['APP_ENV'])) {
if (!class_exists(Dotenv::class)) {
throw new \RuntimeException('APP_ENV environment variable is not defined. You need to define environment variables for configuration or add "symfony/dotenv" as a Composer dependency to load variables from a .env file.');
}
(new Dotenv())->load(__DIR__.'/../.env');
}
$env = $_SERVER['APP_ENV'] ?? 'dev';
$debug = (bool) ($_SERVER['APP_DEBUG'] ?? ('prod' !== $env));
if ($debug) {
umask(0000);
Debug::enable();
}
if ($trustedProxies = $_SERVER['TRUSTED_PROXIES'] ?? false) {
Request::setTrustedProxies(explode(',', $trustedProxies), Request::HEADER_X_FORWARDED_ALL ^ Request::HEADER_X_FORWARDED_HOST);
}
if ($trustedHosts = $_SERVER['TRUSTED_HOSTS'] ?? false) {
Request::setTrustedHosts(explode(',', $trustedHosts));
}
$kernel = new Kernel($env, $debug);
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
when I run the php bin/console cache:clear --env=prod it gives an error because the .env file does not exist
the code for config/services.yaml is
# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:
locale: 'fr'
version: 1.0.0
default_alert:
council_meeting: 7 # days
project_step: 7 # days
resource_report: 1 # years
resource_contract: 1 # month
resource_capability: 1 # month
services:
# default configuration for services in *this* file
_defaults:
autowire: true # Automatically injects dependencies in your services.
autoconfigure: true # Automatically registers your services as commands, event subscribers, etc.
public: false # Allows optimizing the container by removing unused services; this also means
# fetching services directly from the container via $container->get() won't work.
# The best practice is to be explicit about your dependencies anyway.
# makes classes in src/ available to be used as services
# this creates a service per class whose id is the fully-qualified class name
App\:
resource: '../src/*'
exclude: '../src/{Entity,Migrations,Tests,Kernel.php}'
# controllers are imported separately to make sure services can be injected
# as action arguments even if you don't extend any base controller class
App\Controller\:
resource: '../src/Controller'
tags: ['controller.service_arguments']
# add more service definitions when explicit configuration is needed
# please note that last definitions always *replace* previous ones
activity:
class: App\Service\ActivityLogger
public: true
arguments: ['#doctrine.orm.entity_manager', '#security.token_storage', '#request_stack']
process:
class: App\Service\ProcessProvider
public: true
arguments: ['%kernel.project_dir%']
App\Listener\LoginListener:
arguments: ['#activity']
tags:
- { name: kernel.event_subscriber }
dpolac.twig_lambda.extension:
class: DPolac\TwigLambda\LambdaExtension
tags: [ { name: twig.extension } ]
# ---------------------
# Sonata Admin Services
# ---------------------
app.admin.user:
public: true
class: App\Admin\UserAdmin
arguments: [~, App\Entity\User, App\Controller\UserAdminController]
tags:
- { name: sonata.admin, manager_type: orm, group: admin, label: class.User }
app.admin.user_function:
public: true
class: App\Admin\UserFunctionAdmin
arguments: [~, App\Entity\UserFunction, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, group: admin, label: class.UserFunction }
app.admin.skill_matrix:
class: App\Admin\SkillMatrixAdmin
arguments: [~, App\Entity\SkillMatrix, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, label: class.SkillMatrix }
app.admin.skill_matrix_category:
class: App\Admin\SkillMatrixCategoryAdmin
arguments: [~, App\Entity\SkillMatrixCategory, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, group: skill, label: class.SkillMatrixCategory }
calls:
- [ setTemplate, [list, 'CRUD/Skill/list.html.twig']]
app.admin.client:
class: App\Admin\ClientAdmin
arguments: [~, App\Entity\Client, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, group: project, label: class.Client }
calls:
- [addChild, ['#app.admin.client_site']]
app.admin.client_site:
class: App\Admin\ClientSiteAdmin
arguments: [~, App\Entity\ClientSite, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, label: class.ClientSite}
app.admin.client_numbers:
class: App\Admin\ClientNumbersAdmin
arguments: [~, App\Entity\ClientNumbers, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, label: class.ClientNumbers}
app.admin.resource:
class: App\Admin\ResourceAdmin
arguments: [~, App\Entity\Resource, SonataAdminBundle:CRUD, '#doctrine.orm.entity_manager']
tags:
- { name: sonata.admin, manager_type: orm, group: rc, label: class.Resource }
public: true
calls:
- [ setTemplate, [show, 'CRUD/Resource/show.html.twig']]
- [addChild, ['#app.admin.resource_capability']]
- [addChild, ['#app.admin.resource_contract']]
- [addChild, ['#app.admin.resource_education']]
- [addChild, ['#app.admin.resource_experience']]
- [addChild, ['#app.admin.resource_lang']]
- [addChild, ['#app.admin.resource_report']]
app.admin.council:
public: true
class: App\Admin\CouncilAdmin
arguments: [~, App\Entity\Council, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, group: council, label: class.Council }
calls:
- [ setTemplate, [list, 'CRUD/Council/list.html.twig']]
app.admin.council_meeting:
class: App\Admin\CouncilMeetingAdmin
arguments: [~, App\Entity\CouncilMeeting, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, group: council, label: class.CouncilMeeting }
public: true
app.admin.resource_capability:
class: App\Admin\ResourceCapabilityAdmin
arguments: [~, App\Entity\ResourceCapability, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm , label: class.ResourceCapability}
public: true
app.admin.resource_contract:
class: App\Admin\ResourceContractAdmin
arguments: [~, App\Entity\ResourceContract, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, label: class.ResourceContract}
public: true
app.admin.resource_education:
class: App\Admin\ResourceEducationAdmin
arguments: [~, App\Entity\ResourceEducation, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm , label: class.ResourceEducation}
public: true
app.admin.resource_experience:
class: App\Admin\ResourceExperienceAdmin
arguments: [~, App\Entity\ResourceExperience, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm , label: class.ResourceExperience}
public: true
app.admin.resource_lang:
class: App\Admin\ResourceLangAdmin
arguments: [~, App\Entity\ResourceLang, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, label: class.ResourceLang}
public: true
app.admin.project:
class: App\Admin\ProjectAdmin
arguments: [~, App\Entity\Project, App\Controller\ProjectAdminController]
tags:
- { name: sonata.admin, manager_type: orm, group: project, label: class.Project }
public: true
calls:
- [setTemplate, ['list', 'CRUD/Project\list.html.twig']]
- [setTemplate, ['show', 'CRUD/Project\show.html.twig']]
- [setTemplate, ['edit', 'CRUD/Project\edit.html.twig']]
- [addChild, ['#app.admin.project_eval']]
- [addChild, ['#app.admin.project_status']]
- [addChild, ['#app.admin.project_alert']]
app.admin.project_status:
class: App\Admin\ProjectStatusAdmin
arguments: [~, App\Entity\ProjectStatus, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, label: class.ProjectStatus }
public: true
app.admin.project_eval:
class: App\Admin\ProjectEvalAdmin
arguments: [~, App\Entity\ProjectEval, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, label: class.ProjectEval }
public: true
calls:
- [addChild, ['#app.admin.project_step']]
- [addChild, ['#app.admin.project_staff']]
app.admin.project_staff:
class: App\Admin\ProjectStaffAdmin
arguments: [~, App\Entity\ProjectStaff, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, label: class.ProjectStaff }
public: true
app.admin.project_step:
class: App\Admin\ProjectStepAdmin
arguments: [~, App\Entity\ProjectStep, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, label: class.ProjectStep }
public: true
app.admin.activity:
class: App\Admin\ActivityAdmin
arguments: [~, App\Entity\Activity, App\Controller\ActivityAdminController]
tags:
- { name: sonata.admin, manager_type: orm, group: admin, label: class.Activity }
public: true
app.admin.project_alert:
class: App\Admin\ProjectAlertAdmin
arguments: [~, App\Entity\ProjectAlert, App\Controller\ProjectAlertAdminController]
tags:
- { name: sonata.admin, manager_type: orm, label: class.ProjectAlert }
public: true
app.admin.report_qual_theo:
class: App\Admin\ReportQualTheoAdmin
arguments: [~, App\Entity\ReportQualTheo, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, group: frc, label: class.ReportQualTheo }
public: true
app.admin.report_qual_prat:
class: App\Admin\ReportQualPratAdmin
arguments: [~, App\Entity\ReportQualPrat, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, group: frc, label: class.ReportQualPrat }
public: true
app.admin.resource_report:
class: App\Admin\ResourceReportAdmin
arguments: [~, App\Entity\ResourceReport, App\Controller\ResourceReportAdminController]
tags:
- { name: sonata.admin, manager_type: orm, group: frc, label: class.ResourceReport }
public: true
calls:
- [addChild, ['#app.admin.resource_report_education']]
- [addChild, ['#app.admin.resource_report_forum']]
- [addChild, ['#app.admin.resource_report_project']]
app.admin.resource_report_education:
class: App\Admin\ResourceReportEducationAdmin
arguments: [~, App\Entity\ResourceReportEducation, App\Controller\ResourceReportEducationAdminController]
tags:
- { name: sonata.admin, manager_type: orm, label: class.ResourceReportEducation }
public: true
app.admin.resource_report_forum:
class: App\Admin\ResourceReportForumAdmin
arguments: [~, App\Entity\ResourceReportForum, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, label: class.ResourceReportForum }
public: true
app.admin.resource_report_project:
class: App\Admin\ResourceReportProjectAdmin
arguments: [~, App\Entity\ResourceReportProject, App\Controller\ResourceReportProjectAdminController]
tags:
- { name: sonata.admin, manager_type: orm, label: class.ResourceReportProject }
public: true
calls:
- ['setTemplate', ['list', 'CRUD/ReportResourceProject\list.html.twig']]
app.admin.report_council:
class: App\Admin\ReportCouncilAdmin
arguments: [~, App\Entity\ReportCouncil, SonataAdminBundle:CRUD]
tags:
- { name: sonata.admin, manager_type: orm, group: frc, label: class.ReportCouncil }
public: true
For symfony4 console the environment variables given in .htaccess or in webserver has no effect. so you need to provide the environment variable with the command.
You should run following command to clear cache in production
APP_ENV=prod php bin/console cache:clear
If you are running command from windows cmd then you may need to run like:
set APP_ENV=prod php bin/console cache:clear
You could try changing the 'SetEnv APP_ENV prod' to 'SetEnv APP_ENV dev' in your VirtualHost file.
# Virtual Hosts
#
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
SetEnv APP_ENV dev #<-------------------------------------- here
SetEnv APP_SECRET b33c77e602bc1bafb66f673c1e31aca3
SetEnv DATABASE_URL mysql://root#127.0.0.1:3306/gpac
DocumentRoot "${INSTALL_DIR}/www/gpac/public"
<Directory "${INSTALL_DIR}/www/gpac/public/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Related
How can I call a environnement variable declared in my service.yml?
I'm working on a symfony project that need to be refactorized. I'm trying to call a environnement variable declared in servces.yml When i'm running php bin/console debug:container --parameters I can see the variables. I tried $this->getParameters('param_name'); When I'm dumping them in a controller it's working fine but when i'm trying to access them from a service it is failing -> Method 'getParameter' not found in 'TwitterService' I thought that this method was native in symfony. Here is my twitter service ```namespace App\Services; use Abraham\TwitterOAuth\TwitterOAuth; /** * Class TwitterService. */ class TwitterService { /** #const int NUMBER_OF_TWEETS */ private const NUMBER_OF_TWEETS = 2; /** * #param string $twitterID * * #return array|object */ public function getTwitterFeed($twitterID = 'RISKandMe') { // #todo move config to .env $consumerKey = $this->getParameter('consumer_key'); $consumerSecret = $this->getParameter('consumer_secret'); $accessToken = $this->getParameter('access_token'); $accessTokenSecret = $this->getParameter('access_token'); // Authenticate with twitter $twitterConnection = new TwitterOAuth( $consumerKey, $consumerSecret, $accessToken, $accessTokenSecret ); // Get the user timeline feeds return $twitterConnection->get( 'statuses/user_timeline', [ 'screen_name' => $twitterID, 'count' => self::NUMBER_OF_TWEETS, 'exclude_replies' => false, ] ); } } Here is my services.yml: parameters: locale: 'fr' api_key_validity: '%env(int:APIKEYVALIDITY)%' activation_delay: '%env(int:ACTIVATIONDELAY)%' gophish_api_key: '%env(GOPHISHAPIKEY)%' gophish_server: '%env(GOPHISHSERVER)%' gophish_white_list: '%env(GOPHISHWHITELIST)%' mailjet_public: '%env(MAILJET_PUBLIC_KEY)%' mailjet_secret: '%env(MAILJET_PRIVATE_KEY)%' sender_address: '%env(SENDER_ADDRESS)%' sender_name: '%env(SENDER_NAME)%' consumer_key: '%env(CONSUMER_KEY)%' consumer_secret: '%env(CONSUMER_SECRET)%' access_token: '%env(ACCESS_TOKEN)%' access_token_secret: '%env(ACCESS_TOKEN_SECRET)%' services: _defaults: autowire: true # Automatically injects dependencies in your services. autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. # user_listener: # class: App\EntityListener\UserListener # arguments: ['#logger'] # tags: # - { name: doctrine.orm.entity_listener,entity: App\Entity\User} # form_authenticator: class: App\Security\FormAuthenticator arguments: ["#logger","#router","#security.password_encoder","#doctrine.orm.default_entity_manager",CsrfTokenManagerInterface] token_authenticator: class: App\Security\TokenAuthenticator arguments: ["#logger","#router","#security.password_encoder","#doctrine.orm.default_entity_manager",CsrfTokenManagerInterface,ParameterBagInterface] DbUserProvider: class: App\Security\DbUserProvider FickleUserProvider: class: App\Security\FickleUserProvider BackEndUserProvider: class: App\Security\BackEndUserProvider App\: resource: '../src/*' exclude: '../src/{DependencyInjection,Entity,Migrations,Tests,Kernel.php}' App\Controller\Services\Helper: arguments: ['#logger','#router','#security.password_encoder','#mailer','#session','#doctrine.orm.default_entity_manager'] tags: ['controller.service_arguments'] App\Controller\Services\GoPhish: arguments: [] tags: [] App\Controller\: resource: '../src/Controller/DashboardController.php' arguments: ["#logger","#router","#security.password_encoder",'#doctrine.orm.default_entity_manager',App\Controller\Services\Helper] tags: ['controller.service_arguments'] twig.extension.intl: class: Twig_Extensions_Extension_Intl tags: - { name: twig.extension } # session.listener: # class: App\Listeners\SessionListener # tags: # - { name: kernel.event_listener, event: kernel.request, method: onKernelRequest } # user.activity_listener: # class: App\Listeners\ActivityListener # tags: # - { name: kernel.event_listener, event: kernel.controller, method: onCoreController } Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler: arguments: - '%env(string:DBCONNEXIONPARAMETERS)%' - { db_table: 'ht_session', db_username: '%env(string:DBUSER)%', db_password: '%env(string:DBPASSWORD)%'} app.services.twitter: class: App\Services\TwitterService If someone has any idea they would be more than appreciated. Thank you very much for you attention.
The $this->getParameter() helper function is only available in controllers extending from the class Symfony\Bundle\FrameworkBundle\Controller\AbstractController;. In order to access a container-parameter in your service you need to inject or autowire it into your service. # services.yml services: _defaults: bind: # schema -> [constructor-variable name]: [parameter name] $consumerSecret: '%consumer_secret%' $consumerKey: '%consumer_key%' # [..] Then use them as follows: class TwitterService { private $csonsumerSecret; private $consumerKey; public function __construct( string $consumerKey, string $consumerSecret, // [..] ) { $this->consumerKey = $consumerKey; $this->consumerSecret = $consumerSecret; // [..] } public function getTwitterFeed($twitterID = 'RISKandMe') { $twitterConnection = new TwitterOAuth( $this->consumerKey, $this->consumerSecret, // [..] );
Circular reference detected for service in symfony2
After updating Symfony from 2.7.2 to 2.7.7 I get following error: Circular reference detected for service "phoenix_content.renderservice", path: "phoenix_content.renderservice -> phoenix_content.twig.environment Here is my services.yml file: services: ## # Dedicated Twig Environment ## phoenix_content.twig.environment: class: Phoenix\Bundle\ContentBundle\Twig\Twig_Environment arguments: ["%kernel.debug%"] phoenix_content.twig.phoenix_extension: class: Phoenix\Bundle\ContentBundle\Twig\Extension\PhoenixExtension arguments: ["#phoenix_content.pageModuleStorage", "#doctrine.orm.entity_manager", "#phoenix_content.renderDirective", "#phoenix_content.renderService"] tags: - { name: phoenix_twig.extension } phoenix_content.twig.loader_module: class: Phoenix\Bundle\ContentBundle\Twig\TwigLoaderModule arguments: [] tags: - { name: phoenix_twig.loader } phoenix_content.twig.compiler: class: Phoenix\Bundle\ContentBundle\Twig\Twig_Compiler arguments: [#phoenix_content.twig.environment] tags: - { name: phoenix_twig.compiler } phoenix_content.twig.token_extractor: class: Phoenix\Bundle\ContentBundle\Twig\TokenExtractor arguments: ["#phoenix_content.twig.environment"] phoenix_content.twig.template: class: Phoenix\Bundle\ContentBundle\Twig\Twig_Template arguments: ["#phoenix_content.twig.environment", "#phoenix_content.pageModuleStorage"] ## # Factories ## phoenix_content.element_factory: class: Phoenix\Bundle\ContentBundle\Element\ElementFactory lazy: true arguments: [] phoenix_content.connector_factory: class: Phoenix\Bundle\ContentBundle\Connector\ConnectorFactory lazy: true arguments: ["#phoenix_content.element_factory", "#doctrine.orm.entity_manager"] ## # Connectors (for connector factory) ## phoenix_content.connector.contentful: class: Phoenix\Bundle\ContentBundle\Connector\ContentfulConnector arguments: ["#phoenix_content.element_factory", "#debug.stopwatch", "#phoenix_content.connector_factory", "%contentful_connector_api_key%", "%contentful_connector_space_id%", "%contentful_connector_catalog_id%"] tags: - { name: phoenix_content.connector } phoenix_content.connector.cumulus: class: Phoenix\Bundle\ContentBundle\Connector\CumulusConnector arguments: ["#phoenix_content.element_factory", "#debug.stopwatch", "%cumulus_connector_host%", "%cumulus_connector_path%", "%cumulus_connector_catalog_id%"] tags: - { name: phoenix_content.connector } phoenix_content.connector.database: class: Phoenix\Bundle\ContentBundle\Connector\DatabaseConnector arguments: ["#phoenix_content.element_factory", "#debug.stopwatch", "#doctrine.orm.entity_manager"] tags: - { name: phoenix_content.connector } ## # Elements (for element factory) ## phoenix_content.element.dummy: class: Phoenix\Bundle\ContentBundle\Element\Type\TypeDummy arguments: ["#phoenix_content.renderDirective"] tags: - { name: phoenix_content.element } phoenix_content.element.string: class: Phoenix\Bundle\ContentBundle\Element\Type\TypeString arguments: ["#phoenix_content.renderDirective"] tags: - { name: phoenix_content.element } phoenix_content.element.image: class: Phoenix\Bundle\ContentBundle\Element\Type\TypeImage arguments: ["%cumulus_dummy_image%", "#phoenix_content.renderDirective"] tags: - { name: phoenix_content.element } phoenix_content.element.link: class: Phoenix\Bundle\ContentBundle\Element\Type\TypeLink arguments: ["#phoenix_content.renderDirective"] tags: - { name: phoenix_content.element } phoenix_content.element.navigation: class: Phoenix\Bundle\ContentBundle\Element\Type\TypeNavigation arguments: ["#phoenix_content.tree_node_repository", "#phoenix_content.renderDirective"] tags: - { name: phoenix_content.element } phoenix_content.tree_node_repository: class: Phoenix\Bundle\ApiBundle\Entity\TreeNodeRepository factory_service: doctrine.orm.entity_manager factory_method: getRepository arguments: - Phoenix\Bundle\ApiBundle\Entity\TreeNode ## # Rendering ## phoenix_content.pageModuleStorage: class: Phoenix\Bundle\ContentBundle\Render\PageModuleStorage arguments: [] lazy: true phoenix_content.renderDirective: class: Phoenix\Bundle\ContentBundle\Render\RenderDirective arguments: [] lazy: true phoenix_content.renderService: class: Phoenix\Bundle\ContentBundle\Render\RenderService arguments: ["#phoenix_content.renderDirective", "#phoenix_content.connector_factory", "#phoenix_content.twig.environment", "#phoenix_content.pageModuleStorage", "%statify.target_path%", "#phoenix_content.placeholderInterpreter"] lazy: true phoenix_content.placeholderInterpreter: class: Phoenix\Bundle\ContentBundle\Render\PlaceholderInterpreter arguments: ["#phoenix_content.connector.contentful"] lazy: true ## # Statification ## phoenix_content.statify: class: Phoenix\Bundle\ContentBundle\Statify\Statify arguments: ["#doctrine.orm.entity_manager", "#phoenix_content.renderService", "%statify.target_path%"] phoenix_content.statify_command: class: Phoenix\Bundle\ContentBundle\Console\StatifyCommand arguments: ["#phoenix_content.statify"] tags: - { name: console.command } ## # Metrics ## phoenix_content.metrics: class: Hal\Application\Command\RunMetricsCommand arguments: [] tags: - { name: console.command } First I was thinking that there is aredundancy in the code but I cann not find one? Do you see any problems here? Or is it a version error?
symfony2.6 route with query params (KnpPaginatorBundle and WhiteOctoberPagerfantaBundle)
Trying to use KnpPaginatorBundle and WhiteOctoberPagerfantaBundle If i have url /categories/tech/plates next page url show me /catalog/categories/tech/plates?/catalog/categories/tech/plates=&page=2 I can not understand why this is happening :( Can anyone help? What am I doing wrong? <?php use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; class AppKernel extends Kernel { public function registerBundles() { $bundles = [ // default symfony project 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(), // additional // new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(), new SimpleThings\EntityAudit\SimpleThingsEntityAuditBundle(), new Sonata\IntlBundle\SonataIntlBundle(), new FOS\JsRoutingBundle\FOSJsRoutingBundle(), new A2lix\TranslationFormBundle\A2lixTranslationFormBundle(), new WhiteOctober\PagerfantaBundle\WhiteOctoberPagerfantaBundle(), new Bazinga\Bundle\JsTranslationBundle\BazingaJsTranslationBundle(), // admin panel new Sonata\CoreBundle\SonataCoreBundle(), new Sonata\BlockBundle\SonataBlockBundle(), new Knp\Bundle\MenuBundle\KnpMenuBundle(), new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(), new Sonata\AdminBundle\SonataAdminBundle(), new Application\Sonata\AdminBundle\ApplicationSonataAdminBundle(), new Sonata\MediaBundle\SonataMediaBundle(), new CoopTilleuls\Bundle\CKEditorSonataMediaBundle\CoopTilleulsCKEditorSonataMediaBundle(), new Application\Sonata\MediaBundle\ApplicationSonataMediaBundle(), // // users new FOS\UserBundle\FOSUserBundle(), new Sonata\UserBundle\SonataUserBundle('FOSUserBundle'), new Sonata\EasyExtendsBundle\SonataEasyExtendsBundle(), new Application\Sonata\UserBundle\ApplicationSonataUserBundle(), new FOS\OAuthServerBundle\FOSOAuthServerBundle(), new Application\FOS\OAuthServerBundle\ApplicationFOSOAuthServerBundle(), // new HWI\Bundle\OAuthBundle\HWIOAuthBundle(), // new Xxx\Bundle\OAuthUserBundle\XxxOAuthUserBundle(), // rest api default new FOS\RestBundle\FOSRestBundle(), new JMS\SerializerBundle\JMSSerializerBundle(), new Nelmio\ApiDocBundle\NelmioApiDocBundle(), new Application\FOS\RestBundle\ApplicationFOSRestBundle(), // form new Ivory\OrderedFormBundle\IvoryOrderedFormBundle(), //order fields with 'position' attribute //form types new Genemu\Bundle\FormBundle\GenemuFormBundle(), new Stnw\DatePickerBundle\StnwDatePickerBundle(), new Ivory\CKEditorBundle\IvoryCKEditorBundle(), new Misd\PhoneNumberBundle\MisdPhoneNumberBundle(), // charts // new Ob\HighchartsBundle\ObHighchartsBundle(), // grid new APY\DataGridBundle\APYDataGridBundle(), // new Lunetics\LocaleBundle\LuneticsLocaleBundle(), new JMS\I18nRoutingBundle\JMSI18nRoutingBundle(), new JMS\TranslationBundle\JMSTranslationBundle(), // project new Xxx\Bundle\AppBundle\XxxAppBundle(), new Xxx\Bundle\CompanyBundle\XxxCompanyBundle(), new Xxx\Bundle\TransactionBundle\XxxTransactionBundle(), new Xxx\Bundle\StoreBundle\XxxStoreBundle(), new Xxx\Bundle\DeviceBundle\XxxDeviceBundle(), new Xxx\Bundle\CatalogBundle\XxxCatalogBundle(), new Xxx\Bundle\ChipBundle\XxxChipBundle(), new Xxx\Bundle\CityBundle\XxxCityBundle(), new Xxx\Bundle\LastActivityBundle\XxxLastActivityBundle(), // frontend new WhiteOctober\BreadcrumbsBundle\WhiteOctoberBreadcrumbsBundle(), new Xxx\ContactBundle\XxxContactBundle(), new Application\Xxx\ContactBundle\ApplicationXxxContactBundle(), new Xxx\Bundle\FaqBundle\XxxFaqBundle(), new Xxx\Bundle\NewsBundle\XxxNewsBundle(), new Xxx\Bundle\MenuBundle\XxxMenuBundle(), new Xxx\Bundle\PageBundle\XxxPageBundle(), new Xxx\Bundle\SmsGatewayBundle\XxxSmsGatewayBundle(), ]; if (in_array($this->getEnvironment(), ['dev', 'test'])) { $bundles[] = new Symfony\Bundle\DebugBundle\DebugBundle(); $bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); $bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle(); $bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle(); // translator, needed for grid $bundles[] = new Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle(); // $bundles[] = new JMS\TranslationBundle\JMSTranslationBundle(); } return $bundles; } public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.yml'); } } # app/config/config.yml imports: - { resource: parameters.yml } - { resource: security.yml } - { resource: ../../vendor/knplabs/doctrine-behaviors/config/orm-services.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_hosts: ~ trusted_proxies: ~ session: # handler_id set to null will use default session handler from php.ini handler_id: ~ fragments: ~ http_method_override: true # Twig Configuration twig: debug: "%kernel.debug%" strict_variables: "%kernel.debug%" exception_controller: 'FOS\RestBundle\Controller\ExceptionController::showAction' form: resources: - 'StnwDatePickerBundle:Form:fields.html.twig' - 'XxxAppBundle:Form:fields.html.twig' globals: locales: "%locales%" # 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 types: json: Sonata\Doctrine\Types\JsonType phone_number: Misd\PhoneNumberBundle\Doctrine\DBAL\Types\PhoneNumberType # 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 } sensio_framework_extra: view: annotations: false fos_rest: param_fetcher_listener: true view: view_response_listener: 'force' formats: xml: true json: true templating_formats: html: true format_listener: rules: - { path: ^/, priorities: [ html, json, xml ], fallback_format: ~, prefer_extension: true } exception: codes: 'Symfony\Component\Routing\Exception\ResourceNotFoundException': 404 'Doctrine\ORM\OptimisticLockException': HTTP_CONFLICT messages: 'Symfony\Component\Routing\Exception\ResourceNotFoundException': true allowed_methods_listener: true access_denied_listener: json: true # serializer: # serialize_null: true body_listener: true disable_csrf_role: ROLE_API nelmio_api_doc: name: Xxx REST API sandbox: authentication: delivery: http # name: apiKey type: bearer # `basic`, `bearer` are supported sonata_block: default_contexts: [cms] blocks: # Enable the SonataAdminBundle block sonata.admin.block.admin_list: contexts: [admin] sonata.admin.block.search_result: contexts: [admin] # Your other blocks sonata.user.block.menu: # used to display the menu in profile pages sonata.user.block.account: # used to display menu option (login option) sonata.block.service.text: sonata.block.service.action: sonata.block.service.rss: sonata_admin: title: Xxx # title_logo: bundles/acmedemo/img/fancy_acme_logo.png templates: # default global templates layout: ApplicationSonataAdminBundle::layout.html.twig ajax: SonataAdminBundle::ajax_layout.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 search: SonataAdminBundle:Core:search.html.twig search_result_block: SonataAdminBundle:Block:block_search_result.html.twig dashboard: blocks: # display a dashboard block - { position: left, type: sonata.admin.block.admin_list } groups: default: fos_user: label: menu.group_users items: [sonata.user.admin.user, sonata.user.admin.group] xxx_company: label: menu.group_company items: [xxx.admin.company, xxx.admin.company_category, xxx.admin.store, xxx.admin.device] xxx_catalog: label: menu.group_catalog items: [xxx.admin.catalog.product, xxx.admin.catalog.product_category, xxx.admin.chip.rule] xxx_transaction: label: menu.group_transaction items: [xxx.admin.transaction] xxx_media: label: menu.group_media items: [sonata.media.admin.media] xxx_news: label: menu.group_news items: [xxx.news.admin.news] xxx_faq: label: menu.group_faq items: [xxx.faq.admin.faq] xxx_page: label: menu.group_page items: [xxx_page.admin.page] xxx_menu: label: menu.group_menu items: [xxx_menu.admin.menu, xxx_menu.admin.menu_type] xxx_city: label: menu.group_city items: [xxx_city.admin.city] xxx_sms_gateway: label: menu.group_sms_gateway items: [xxx_sms_gateway.admin.message] security: handler: sonata.admin.security.handler.role # acl security information information: ADMIN: [MASTER] # permissions not related to an object instance and also to be available when objects do not exist # the DELETE admin permission means the user is allowed to batch delete objects admin_permissions: [CREATE, LIST, DELETE, UNDELETE, EXPORT, OPERATOR, MASTER] # permission related to the objects object_permissions: [VIEW, EDIT, DELETE, UNDELETE, OPERATOR, MASTER, OWNER] options: html5_validate: true # does not use html5 validation confirm_exit: false # disable confirmation when quitting with unsaved changes use_select2: true # disable select2 pager_links: 5 # pager max links to display # set to true to persist filter settings per admin module in the user's session persist_filters: false #read http://sonata-project.org/bundles/media/2-2/doc/reference/installation.html sonata_media: # if you don't use default namespace configuration #class: # media: MyVendor\MediaBundle\Entity\Media # gallery: MyVendor\MediaBundle\Entity\Gallery # gallery_has_media: MyVendor\MediaBundle\Entity\GalleryHasMedia default_context: default db_driver: doctrine_orm # or doctrine_mongodb, doctrine_phpcr contexts: default: # the default context is mandatory providers: # - sonata.media.provider.dailymotion - sonata.media.provider.youtube - sonata.media.provider.image # - sonata.media.provider.file formats: ~ small: { width: 100 , quality: 70} big: { width: 500 , quality: 70} cdn: server: path: /uploads/media # http://media.sonata-project.org/ filesystem: local: directory: %kernel.root_dir%/../web/uploads/media create: false # Notice: EntityAudit currently only works with a DBAL Connection and EntityManager named "default". simple_things_entity_audit: # таблицы мультиперевода автоматически НЕ цепляются, поэтому нужно указывать в ручную в этом списке audited_entities: - Application\Sonata\UserBundle\Entity\User - Application\Sonata\UserBundle\Entity\Group # If you need to exclude some entity properties from triggering a revision use: # global_ignore_columns: # - created_at # - updated_at sonata_intl: timezone: default: Europe/Moscow detectors: - sonata.intl.timezone_detector.user - sonata.intl.timezone_detector.locale locales: ru: Europe/Chisinau fos_user: db_driver: orm # can be orm or odm firewall_name: admin user_class: Application\Sonata\UserBundle\Entity\User from_email: address: noreply#xxx.com sender_name: Xxx Noreply registration: form: type: application_sonata_user_registration handler: fos_user.registration.form.handler.default name: fos_user_registration_form validation_groups: [XxxRegistration] confirmation: enabled: true template: ApplicationSonataUserBundle:Registration:email.txt.twig profile: form: type: application_fos_user_profile handler: fos_user.profile.form.handler.default name: fos_user_profile_form validation_groups: [Authentication] change_password: form: type: application_fos_user_change_password handler: fos_user.change_password.form.handler.default name: fos_user_change_password_form validation_groups: [ChangePassword, Default] group: group_class: Application\Sonata\UserBundle\Entity\Group group_manager: sonata.user.orm.group_manager # If you're using doctrine orm service: user_manager: sonata.user.orm.user_manager # If you're using doctrine orm mailer: fos_user.mailer.twig_swift sonata_user: security_acl: false class: user: Application\Sonata\UserBundle\Entity\User group: Application\Sonata\UserBundle\Entity\Group profile: # Profile Form (firstname, lastname, etc ...) form: type: application_sonata_user_profile handler: sonata_user.form.handler.profile name: sonata_user_profile_form validation_groups: [Profile] impersonating: route: sonata_admin_dashboard parameters: sonata.user.admin.user.class: Application\Sonata\UserBundle\Admin\UserAdmin knp.doctrine_behaviors.blameable_listener.user_entity: Application\Sonata\UserBundle\Admin\UserAdmin # sonata.user.admin.user.translation_xxxin: ApplicationUserBundle fos_oauth_server: db_driver: orm # Driver availables: orm, mongodb, or propel client_class: Application\FOS\OAuthServerBundle\Entity\Client access_token_class: Application\FOS\OAuthServerBundle\Entity\AccessToken refresh_token_class: Application\FOS\OAuthServerBundle\Entity\RefreshToken auth_code_class: Application\FOS\OAuthServerBundle\Entity\AuthCode service: user_provider: fos_user.user_manager options: access_token_lifetime: 3600 #seconds token_type: Bearer # supported_scopes: oauth_scope_scanner test1 fos_js_routing: cache_control: # All are optional, defaults shown public: false # can be true (public) or false (private) maxage: null # integer value, e.g. 300 smaxage: null # integer value, e.g. 300 expires: null # anything that can be fed to "new \DateTime($expires)", e.g. "5 minutes" vary: [] # string or array, e.g. "Cookie" or [ Cookie, Accept ] jms_serializer: metadata: auto_detection: true directories: SonataUserBundle: namespace_prefix: "Sonata\\UserBundle" path: "#ApplicationSonataUserBundle/Resources/config/serializer/SonataUserBundle" FOSUserBundle: namespace_prefix: "FOS\\UserBundle" path: "#ApplicationSonataUserBundle/Resources/config/serializer/FOSUserBundle/" white_october_pagerfanta: exceptions_strategy: out_of_range_page: to_http_not_found not_valid_current_page: to_http_not_found apy_data_grid: limits: [20, 50, 100] pagerfanta: enable: true #default false view_class: Pagerfanta\View\TwitterBootstrap3View #default Pagerfanta\View\DefaultView options: #all options of pager fanta view constructor prev_message : « next_message : » genemu_form: date: ~ captcha: ~ # tinymce: ~ a2lix_translation_form: locales: %locales% # [1] required_locales: %locales% # [2] manager_registry: doctrine # [3] templating: "A2lixTranslationFormBundle::default.html.twig" # [4] white_october_breadcrumbs: viewTemplate: "XxxAppBundle:Breadcrumbs:breadcrumbs.html.twig" separator: "" ivory_ck_editor: default_config: default configs: default: filebrowserBrowseRoute: admin_sonata_media_media_browser filebrowserImageBrowseRoute: admin_sonata_media_media_browser # Display images by default when clicking the image dialog browse button filebrowserImageBrowseRouteParameters: provider: sonata.media.provider.image filebrowserUploadRoute: admin_sonata_media_media_upload filebrowserUploadRouteParameters: provider: sonata.media.provider.file # Upload file as image when sending a file from the image dialog filebrowserImageUploadRoute: admin_sonata_media_media_upload filebrowserImageUploadRouteParameters: provider: sonata.media.provider.image context: my-context # Optional, to upload in a custom context xxx_transaction: sms_confirmation: %transaction_sms_confirmation% xxx_contact: store_data: false contact_class: Xxx\ContactBundle\Model\BaseContact form: type: application_xxx_contact # handler: xxx_contact.form.handler.default # name: contact_form # validation_groups: [Default] # subject_provider: xxx_contact.subject_provider.noop captcha_type: genemu_captcha # email: # mailer: xxx_contact.mailer.twig_swift recipient_address: "%admin_email%" # Required # template: XxxContactBundle:Contact:email.txt.twig jms_i18n_routing: default_locale: %locale% locales: %locales% strategy: prefix_except_default xxx_sms_gateway: monolog_handler: monolog.logger.sms_gateway message: class: Xxx\Bundle\SmsGatewayBundle\Entity\Message manager: xxx_sms_gateway.entity.message_manager default_gateway: bulk_sms gateways: bulk_sms: sender: %sms_gateway_bulk_sms_sender% username: %sms_gateway_bulk_sms_username% password: %sms_gateway_bulk_sms_password% mode: charset: plaintext # plaintext, utf8, windows-1251 max_number_of_chars: 160 # 160 for plaintext, 70 for UTF8 and Windows 1251 # base_url: http://79.170.224.75/BulkSMSAPI/UnifunBulkSMSAPI.asmx/SendSMSNoneDigitsEncoded base_url: http://79.170.224.75/BulkSMSAPI/UnifunBulkSMSAPI.asmx/SendSMSSimple report: enabled: false mask: 31 # 1, 2, 4, 8, 16, 31 route: xxx_sms_gateway_sms_report_bulk_sms bazinga_js_translation: locale_fallback: %locale% active_locales: %locales% default_xxxin: XxxAppBundle xxx_last_activity: audited_entities: # - Application\Sonata\UserBundle\Entity\User # при регистарции нет имени - Xxx\Bundle\CompanyBundle\Entity\Company - Xxx\Bundle\FaqBundle\Entity\Faq - Xxx\Bundle\NewsBundle\Entity\News Standart pagination with pagerfanta {% if pagination.haveToPaginate %} {{ pagerfanta(pagination, 'twitter_bootstrap3_translated') }} {% endif %} Standart pagination call // return some query $query = $this->getManager()->getQueryAllByCategory($findCompaniesByCategory); $page = $request->query->get('page', 1); $pagination = new Pagerfanta(new DoctrineORMAdapter($query)); $pagination ->setMaxPerPage($this->container->getParameter('items_on_page')) ->setCurrentPage($page) ;
Symfony2 - Sonata adminbundle menu won't show
.. 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: noreply#POKEtudiant.com #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 }
SonataUserBundle User entity doesn't map changes
I want to make the email field optional. I read that i need to use #AttributeOverrides annotation. My Application\Sonata\UserBundle\Entity\User class: namespace Application\Sonata\UserBundle\Entity; use Sonata\UserBundle\Entity\BaseUser as BaseUser; use Doctrine\ORM\Mapping as ORM; use Doctrine\Common\Collections\ArrayCollection; /** * * #ORM\Entity * #ORM\Table(name="gm_user") * #AttributeOverrides({ * #ORM\AttributeOverride(name="email", column=#ORM\Column(nullable=true)), * #ORM\AttributeOverride(name="emailCanonical", column=#ORM\Column(nullable=true, unique=false)) * }) */ class User extends BaseUser { /** * #var integer $id * * #ORM\Id * #ORM\Column(type="integer") * #ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * Get id * * #return integer $id */ public function getId() { return $this->id; } } My config.yml: imports: - { resource: parameters.yml } - { resource: security.yml } framework: #esi: ~ translator: { fallback: %locale% } secret: %secret% router: resource: "%kernel.root_dir%/config/routing.yml" strict_requirements: %kernel.debug% form: ~ csrf_protection: ~ validation: { enable_annotations: true } templating: engines: ['twig'] #assets_version: SomeVersionScheme default_locale: "%locale%" trusted_proxies: ~ session: ~ fragments: ~ # 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% types: json: Sonata\Doctrine\Types\JsonType 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 } # FOSUserBundle Configuration fos_user: db_driver: orm firewall_name: main user_class: Application\Sonata\UserBundle\Entity\User group: group_class: Application\Sonata\UserBundle\Entity\Group profile: # Authentication Form form: type: fos_user_profile handler: fos_user.profile.form.handler.default name: fos_user_profile_form validation_groups: [Authentication] 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.action: sonata.block.service.rss: # Some specific block from the SonataMediaBundle #sonata.media.block.media: #sonata.media.block.gallery: #sonata.media.block.feature_media: sonata_admin: title: Admin Panel title_logo: /bundles/sonataadmin/logo_title.png templates: # default global templates layout: SonataAdminBundle::standard_layout.html.twig ajax: SonataAdminBundle::ajax_layout.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 dashboard: blocks: # display a dashboard block - { position: left, type: sonata.admin.block.admin_list } groups: 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 When I'm trying to change schema by php app/console doctrine:schema:update --force I get: Nothing to update - your database is already in sync with the current entity metadata.
Problem solved! Everything works after: Deleting files under Application\Sonata\UserBundle\Resources\config\doctrine\ directory Running php app/console doctrine:schema:update --force