I've added the SonataMediaBundle to a project I'm working on which already implements the SonataAdminBundle.
One thing that is strange is that, out of the box, the form/field labels aren't being translated in the admin dashboard or any of the CRUD components.
I though it was because this was a admin provided by the bundle vs an admin that I wrote, but I also have the SonataUserBundle integrated and the admins for those are translated just fine (using I'm assuming the sonata.admin.label.strategy.native strategy, which according to this is the default and should generate human readable labels)
Here's an illustration of the issue:
And another that shows how even next to the admin exposed by inclusion of the SonataUserBundle that the translations still aren't working.
Let me know if you need to see anything else.
And for version information, Here's my composer.json
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/" }
},
"require": {
"php": ">=5.3.3"
, "symfony/symfony": "2.3.*"
, "doctrine/orm": ">=2.2.3,<2.4-dev"
, "doctrine/doctrine-bundle": "1.2.*"
, "twig/extensions": "1.0.*"
, "symfony/assetic-bundle": "2.3.*"
, "symfony/swiftmailer-bundle": "2.3.*"
, "symfony/monolog-bundle": "2.3.*"
, "sensio/distribution-bundle": "2.3.*"
, "sensio/framework-extra-bundle": "2.3.*"
, "sensio/generator-bundle": "2.3.*"
, "incenteev/composer-parameter-handler": "~2.0"
, "sonata-project/cache-bundle": "2.1.6"
, "sonata-project/admin-bundle": "2.2.11"
, "sonata-project/doctrine-orm-admin-bundle": "2.2.3"
, "friendsofsymfony/user-bundle": "1.3.*"
, "sonata-project/user-bundle": "2.2.3"
, "stof/doctrine-extensions-bundle": "v1.1.0"
, "sonata-project/formatter-bundle": "2.3.1"
, "sonata-project/media-bundle": "2.2.3"
, "sonata-project/core-bundle": "~2.2.5"
},
"scripts": {
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile"
]
},
"config": {
"bin-dir": "bin"
},
"minimum-stability": "stable",
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.3-dev"
}
}
}
Framework section of config.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
I think you should try and upgrade your media bundle since your using an outdated version. Your using a branch that has his last change 7 months ago so if I was you I considered upgrading to 2.2.8 and that'll hopefully fix the problem.
Maybe you need to clear cache files. Translations files need the cache to be cleared once generated.
Related
I work on a project who run the frontend with vue js and the backend with symfony.
I installed the profiler but it doesn't show I don't know if there is a procedure to make it show with vue js.
composer.json :
"require-dev": {
"sensio/generator-bundle": "~3.0",
"symfony/phpunit-bridge": "~2.7",
"doctrine/doctrine-fixtures-bundle": "2.3.0",
"symfony/profiler-pack": "^1.0"
},
config_dev.yml
framework:
router:
resource: "%kernel.root_dir%/config/routing_dev.yml"
strict_requirements: true
profiler:
enabled: true
collect: true
only_exceptions: false
web_profiler:
toolbar: true
intercept_redirects: false
I tried to reinstalled it but nothing changed
I have a problem on my symfony project version 4.4.9, when i type php bin/console make:entity this errors it display to me
There is no extension able to load the configuration for "when#test"
composer.json
"require": {
"php": ">=7.1.3",
"ext-ctype": "*",
"ext-iconv": "*",
"doctrine/annotations": "^1.13",
"doctrine/doctrine-bundle": "^2.5",
"doctrine/doctrine-migrations-bundle": "^3.2",
"doctrine/orm": "^2.11",
"symfony/console": "4.4.*",
"symfony/dotenv": "4.4.*",
"symfony/flex": "^1.3.1",
"symfony/framework-bundle": "4.4.*",
"symfony/proxy-manager-bridge": "4.4.*",
"symfony/twig-bundle": "4.4.*",
"symfony/yaml": "4.4.*",
"twig/extra-bundle": "^2.12|^3.0",
"twig/twig": "^2.12|^3.0"
},
PHP 7
The syntax when#{env} was introduced on Symfony ^5.3
You need to downgrade the doctrine-bundle to a compatible version that works with Symfony ^4.4.
problem solved :
i delete this part of code from config>packages>doctrine.yaml :
when#test:
doctrine:
dbal:
# "TEST_TOKEN" is typically set by ParaTest
dbname_suffix: '_test%env(default::TEST_TOKEN)%'
when#prod:
doctrine:
orm:
auto_generate_proxy_classes: false
query_cache_driver:
type: pool
pool: doctrine.system_cache_pool
result_cache_driver:
type: pool
pool: doctrine.result_cache_pool
framework:
cache:
pools:
doctrine.result_cache_pool:
adapter: cache.app
doctrine.system_cache_pool:
adapter: cache.system
I have linux mint, when I try to start a project I get the error:
This page isn’t working.
Having executed the command: php app / check.php writes that everything is OK and the system is ready to run (Your system is ready to run Symfony projects)
When executing the cache clear command (or any other command via the console):
php app/console cache:clear --env=prod
or
php app/console cache:clear -e prod
I get an error:
[RuntimeException] The
factory can only instantiate \Redis classes: Redis asked
langu2.loc.conf:
<VirtualHost *:80>
ServerName domain.tld
ServerAlias langu2.loc
DocumentRoot /var/www/langu2.loc/web
<Directory /var/www/langu2.loc/web>
AllowOverride None
Order Allow,Deny
Allow from All
Require all granted
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php [QSA,L]
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
</Directory>
# uncomment the following lines if you install assets as symlinks
# or run into problems when compiling LESS/Sass/CoffeeScript assets
# <Directory /var/www/langu2.loc>
# Options FollowSymlinks
# </Directory>
# optionally disable the RewriteEngine for the asset directories
# which will allow apache to simply reply with a 404 when files are
# not found instead of passing the request into the full symfony stack
<Directory /var/www/langu2.loc/web/bundles>
<IfModule mod_rewrite.c>
RewriteEngine Off
</IfModule>
</Directory>
ErrorLog /var/log/apache2/langu2_error.log
CustomLog /var/log/apache2/langu2_access.log combined
parameters.yml:
parameters:
database_host: 127.0.0.1
database_port: 3306
database_name: langu
database_user: root
database_password: 123456
admin_database_host: 127.0.0.1
admin_database_port: 3306
admin_database_name: langu
admin_database_user: root
admin_database_password: 123456
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: null
mailer_password: null
mailer_override_address: { }
secret: ThisTokenIsNotSoSecretChangeIt
google_client_id: null
google_client_secret: null
google_app_name: null
google_app_scopes: null
tokbox_api_key: null
tokbox_api_secret: null
tokbox_session_routed_mode: false
mangopay_client_id: null
mangopay_client_password: null
mangopay_base_url: null
mangopay_debug_mode: true
fixer_key: d7a2c4d1ad4672aafe12a35ef07426e3
langu_exchange_rate_fee: !!float 0
langu_wallets:
EUR:
wallet: 17988934
user: 17988933
GBP:
wallet: 17988936
user: 17988933
USD:
wallet: 17988935
user: 17988933
PLN:
wallet: 17988937
user: 17988933
refund_fee: 0.15
refund_compensation: 0.15
refund_deductions_limit: 0.5
snippets:
google_analytics: false
zopim: false
go_squared: false
hotjar: false
facebook: false
google_tag_manager: false
google_remarketing: false
autopilot: false
router.request_context.host: langu2.loc
router.request_context.scheme: http
redis.password: null
redis.port: 6379
liip_imagine_data_path:
- '%kernel.root_dir%/../web/uploads/'
- '%kernel.root_dir%/../web/images/'
- '%kernel.root_dir%/../uploads/'
main_domain: langu2.loc
allowed_mimetypes_lib:
- text/plain
- text/richtext
- application/rtf
- image/jpg
- image/jpeg
- image/png
- image/gif
- application/pdf
- video/avi
- video/msvideo
- video/mpeg
- video/H264
- video/ogg
- video/mp4
- audio/mp4
- audio/mpeg
- audio/ogg
- application/vnd.ms-excel
- application/msword
- application/vnd.oasis.opendocument.text
- application/vnd.oasis.opendocument.spreadsheet
- application/vnd.oasis.opendocument.presentation
- application/vnd.openxmlformats-officedocument.wordprocessingml.document
- application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
- application/vnd.ms-powerpoint
- application/vnd.openxmlformats-officedocument.presentationml.presentation
max_size_lib: 10485760
redis.yml:
snc_redis:
clients:
default:
type: phpredis
alias: default
dsn: redis://localhost
logging: false
session:
client: default
prefix: "session:php:"
composer.json
{
"name": "patryk/langu_2",
"license": "proprietary",
"type": "project",
"autoload": {
"psr-4": {
"": "src/"
},
"classmap": [
"app/AppKernel.php",
"app/AppCache.php",
"api/ApiKernel.php",
"api/ApiCache.php",
"admin/AdminKernel.php",
"admin/AdminCache.php"
]
},
"require": {
"php": ">=7.0",
"symfony/symfony": "2.8.*",
"doctrine/orm": "^2.4.8",
"doctrine/doctrine-bundle": "~1.4",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~5.0",
"sensio/framework-extra-bundle": "^3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"google/apiclient": "^2.1",
"troopers/mangopay-bundle": "^2.0",
"pinano/select2-bundle": "^4.0",
"liip/imagine-bundle": "^1.6",
"oneup/uploader-bundle": "^1.7",
"vich/uploader-bundle": "^1.6",
"ocramius/proxy-manager": "^1.0",
"nesbot/carbon": "^1.32",
"twig/extensions": "^1.4",
"webit/bcmath-bundle": "^1.2",
"opentok/opentok": "^2.4",
"debesha/doctrine-hydration-profiler-bundle": "^1.2",
"willdurand/js-translation-bundle": "^2.6",
"knplabs/knp-snappy-bundle": "^1.4",
"h4cc/wkhtmltopdf-amd64": "^0.12.3",
"cocur/slugify": "^2.3",
"sonata-project/doctrine-extensions": "^1.0",
"hampe/zurb-ink-bundle": "^2.2",
"suncat/mobile-detect-bundle": "^1.0",
"snc/redis-bundle": "^2.0",
"doctrine/doctrine-migrations-bundle": "^1.2",
"stof/doctrine-extensions-bundle": "^1.2",
"phpunit/phpunit": "^6.3",
"knplabs/knp-markdown-bundle": "^1.5",
"sonata-project/admin-bundle": "^3.12",
"sonata-project/doctrine-orm-admin-bundle": "^3.1",
"sonata-project/user-bundle": "^3.2",
"sonata-project/easy-extends-bundle": "^2.1",
"sonata-project/intl-bundle": "^2.3",
"sonata-project/translation-bundle": "^2.1",
"friendsofsymfony/user-bundle": "^1.3",
"sonata-project/formatter-bundle": "^3.2",
"helios-ag/fm-elfinder-bundle": "~6",
"a2lix/translation-form-bundle": "~1.0",
"pusher/pusher-php-server": "^3.1",
"league/iso3166": "^2.1",
"autologic-web/redirect-bundle": "^0.2.2"
},
"require-dev": {
"sensio/generator-bundle": "~3.0",
"symfony/phpunit-bridge": "~2.7"
},
"scripts": {
"symfony-scripts": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap"
],
"post-install-cmd": [
"#symfony-scripts"
],
"post-update-cmd": [
"#symfony-scripts"
]
},
"config": {
"bin-dir": "bin",
"component-dir": "web/assets"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": null
}
}
Maybe you can help me, I'm trying to set up Travic-ci account, but on the build I get errors when composer install:
Generating autoload files
Updating the "app/config/parameters.yml" file
[Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException]
Circular reference detected for parameter "database_driver" ("database_driver" > "database_driver").
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
My travis.yml:
language: php
php:
- 5.5
before_script:
- cp app/config/parameters.yml.dist app/config/parameters.yml
- composer install
script:
- phpunit -c app
composer.json:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/", "SymfonyStandard": "app/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.6.*",
"doctrine/orm": "~2.2,>=2.2.3,<2.5",
"doctrine/dbal": "<2.5",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~3.0,>=3.0.12",
"sensio/framework-extra-bundle": "~3.0,>=3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"twbs/bootstrap": "3.3.*#dev",
"components/jquery": "2.1.*",
"doctrine/doctrine-fixtures-bundle": "2.2.*",
"friendsofsymfony/user-bundle": "~2.0#dev"
},
"require-dev": {
"sensio/generator-bundle": "~2.3",
"ongr/ongr-strict-standard": "~1.0",
"squizlabs/php_codesniffer": "~1",
"phpmd/phpmd": "#stable",
"phpunit/phpunit": "4.6.*"
},
"scripts": {
"post-root-package-install": [
"SymfonyStandard\\Composer::hookRootPackageInstall"
],
"post-install-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
],
"post-update-cmd": [
"Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::removeSymfonyStandardFiles",
"Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
]
},
"config": {
"bin-dir": "bin"
},
"extra": {
"symfony-app-dir": "app",
"symfony-web-dir": "web",
"symfony-assets-install": "relative",
"incenteev-parameters": {
"file": "app/config/parameters.yml"
},
"branch-alias": {
"dev-master": "2.6-dev"
}
}
}
parameters.yml.dist:
This file is a "template" of what your parameters.yml file should look like parameters:
database_driver: "%database_driver%"
database_host: "%database_host%"
database_port: "%database_port%"
database_name: "%database_name%"
database_user: "%database_user%"
database_password: "%database_password%"
# You should uncomment this if you want use pdo_sqlite
# database_path: "%kernel.root_dir%/data.db3"
mailer_transport: ~
mailer_host: ~
mailer_user: ~
mailer_password: ~
locale: en
# A secret key that's used to generate certain security-related tokens
secret: ~
#keys for GoodReads and Amazon API
goodreads_key: ~
amazon_key: ~
amazon_secret_key: ~
amazon_tag: ~
All variables, denoted by %%, are expected to be set as environment variables, which your travis build/user environment lacks.
I am using symfony2.3.X and sonata admin bundle with fos user bundle.
All installation are success fully completed through provided documentation.
But when i extend sonata user profile and want to edit then show me error:
None of the chained routers were able to generate route: Route 'sonata_user_profile_visit' not found
I don't know why ?
This is third party bundle version stability problem ?
Or my configuration problem ?
composer.json
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.3.*",
"symfony/assetic-bundle": "2.3.*",
"symfony/swiftmailer-bundle": "2.3.*",
"symfony/monolog-bundle": "2.3.*",
"symfony/swiftmailer-bundle": "~2.3",
"symfony-cmf/routing-bundle": "1.1.*#dev",
"symfony-cmf/routing": "1.1.*#dev",
"doctrine/orm": ">=2.2.3,<2.4-dev",
"doctrine/doctrine-bundle": "1.2.*",
"doctrine/doctrine-migrations-bundle": "dev-master",
"doctrine/migrations": "dev-master",
"doctrine/doctrine-fixtures-bundle": "2.1.*#dev",
"doctrine/data-fixtures": "1.0.*#dev",
"twig/extensions": "1.0.*",
"twig/twig": "~1.12",
"jms/security-extra-bundle": "~1.5",
"jms/di-extra-bundle": "~1.4",
"sensio/distribution-bundle": "2.3.*",
"sensio/framework-extra-bundle": "2.3.*",
"sensio/generator-bundle": "2.3.*",
"knplabs/gaufrette": "0.1.4",
"knplabs/knp-menu-bundle": "1.1.x-dev",
"knplabs/knp-markdown-bundle": "1.2.*#dev",
"sonata-project/easy-extends-bundle": "~2.1",
"sonata-project/seo-bundle": "~1",
"sonata-project/doctrine-extensions": "~1",
"sonata-project/intl-bundle": "~2.1",
"sonata-project/doctrine-orm-admin-bundle": "2.2.*#dev",
"sonata-project/notification-bundle": "~2.2",
"sonata-project/block-bundle": "~2.2",
"sonata-project/media-bundle": "2.2.*#dev",
"sonata-project/user-bundle": "2.2.*#dev",
"sonata-project/cache-bundle": "~2.1",
"sonata-project/page-bundle": "~2.3",
"sonata-project/formatter-bundle": "~2.3",
"sonata-project/news-bundle": "~2.3",
"friendsofsymfony/facebook-bundle": "*",
"friendsofsymfony/user-bundle": "1.3.*",
"dflydev/markdown": "~1.0",
"simplethings/entity-audit-bundle": "~0.5",
"willdurand/faker-bundle": "~1.0",
"incenteev/composer-parameter-handler": "~2.0",
"sonata-project/admin-bundle": "master"
},
routing.yml
fos_user_security:
resource: "#FOSUserBundle/Resources/config/routing/security.xml"
fos_user_profile:
resource: "#FOSUserBundle/Resources/config/routing/profile.xml"
prefix: /
fos_user_register:
resource: "#FOSUserBundle/Resources/config/routing/registration.xml"
prefix: /register
fos_user_resetting:
resource: "#FOSUserBundle/Resources/config/routing/resetting.xml"
prefix: /resetting
fos_user_change_password:
resource: "#FOSUserBundle/Resources/config/routing/change_password.xml"
prefix: /{username}
fos_user_group:
resource: "#FOSUserBundle/Resources/config/routing/group.xml"
prefix: /group
admin:
resource: '#SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
prefix: /admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin
soanata_user:
resource: '#SonataUserBundle/Resources/config/routing/admin_security.xml'
prefix: /admin
soanata_user:
resource: '#SonataUserBundle/Resources/config/routing/admin_security.xml'
prefix: /admin
profile controller
<?php
namespace XXX\UserBundle\Controller;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Sonata\UserBundle\Controller\ProfileController as BaseController;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use FOS\UserBundle\Model\UserInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
use FOS\UserBundle\Event\FormEvent;
use FOS\UserBundle\Event\FilterUserResponseEvent;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use FOS\UserBundle\FOSUserEvents;
class ProfileController extends BaseController
{
public function editAction()
{
return parent::editAction();
}
}
You have a typo in soanata_user. And did you complete steps listed in SonataUserBundle configuration? Especially near the end about routing configuration.