Symfony2/Doctrine2.4 "It's a requirement to specify a Metadata Driver" - php

I want to use some of the features of Doctrine 2.4 (mainly named entity listeners) and $event->properyHasChanged('property') and updated my composer.json to this collection:
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "2.4.3",
"doctrine/doctrine-bundle": "~1.3",
"twig/extensions": "~1.0",
"symfony/assetic-bundle": "~2.3",
"symfony/swiftmailer-bundle": "~2.3",
"symfony/monolog-bundle": "~2.4",
"sensio/distribution-bundle": "~2.3",
"sensio/framework-extra-bundle": "~2.3",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
"stof/doctrine-extensions-bundle": "dev-master",
"friendsofsymfony/jsrouting-bundle": "~1.1",
"friendsofsymfony/rest-bundle": "dev-master",
"sprain/validator-bundle": "dev-master",
"willdurand/geocoder-bundle": "#stable",
"friendsofsymfony/user-bundle": "~2.0#dev",
"escapestudios/wsse-authentication-bundle": "2.3.x-dev",
"jms/serializer-bundle": "dev-master",
"doctrine/doctrine-fixtures-bundle": "2.2.*",
"luxifer/doctrine-functions": "dev-master"
},
The composer.phar updates without problems until the end.
After updating or when I try to use any console method (or the symfony2 app) I'm getting this error:
[Doctrine\ORM\ORMException]
It's a requirement to specify a Metadata Driver and pass it to Doctrine\ORM\Configuration::setMetadataDriverImpl().
My Doctrine configuration is as follows:
doctrine:
dbal:
driver: %database_driver%
host: %database_host%
port: %database_port%
dbname: %database_name%
user: %database_user%
password: %database_password%
charset: UTF8
orm:
auto_generate_proxy_classes: %kernel.debug%
entity_managers:
default:
auto_mapping: true
Rolling back to doctrine 2.2 works.
Is there a good example of symfony2 and Doctrine 2.4? Because even in the current version (2.6 of Symfony2 they are using an older version of Doctrine.
Any help is appreciated!

The default configuration as stated in the Doctrine Bundle docs is as follows:
doctrine:
orm:
auto_mapping: true
# the standard distribution overrides this to be true in debug, false otherwise
auto_generate_proxy_classes: false
proxy_namespace: Proxies
proxy_dir: %kernel.cache_dir%/doctrine/orm/Proxies
default_entity_manager: default
metadata_cache_driver: array
query_cache_driver: array
result_cache_driver: array
As you can see it adds a Metadata Driver of type array.
Try and see if this solves your problem.

Related

Symfony profiler not showing with vue js

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

There is no extension able to load the configuration for "when#test"

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

Error when deploying a project on symfony 2.8

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
}
}

symfony and Travis build composer error

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.

None of the chained routers were able to generate route: Route

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.

Categories