Symfony profiler not showing with vue js - php

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

Related

Adding property to Symfony BaseModel

I have the below symfony model and I need to add a name property (see below) to the existing model and then update the database accordingly. What is the proper way to accomplish this? I appreciate any suggestions.
I tried running php bin/console doctrine:database:drop and then php bin/console doctrine:database:create, hoping it'll make the necessary mappings, without any success, I am getting the following error: You have requested a non-existent service "doctrine".
This seems to be overly complicated and I am sure theres a simpler way to accomplish this. I appreciate any suggestions.
composer.json snippet
"php": ">=5.5.9",
"symfony/symfony": "3.0.*",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
"symfony/swiftmailer-bundle": "^2.3",
"symfony/monolog-bundle": "^2.8",
"sensio/distribution-bundle": "^5.0",
"sensio/framework-extra-bundle": "^3.0.2",
NoticeSettings.php
<?php
namespace AppBundle\Model;
class NoticeSettings extends BaseModel
{
protected $table = "notice_settings";
/**
* #Assert\Type(type="string")
*/
protected $notice;
/**
* #Assert\Type(type="string")
*/
protected $name;
}
config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: services.yml }
parameters:
locale: en
uploads_directory: '%kernel.root_dir%/../uploads'
framework:
#esi: ~
#translator: { fallbacks: ["%locale%"] }
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
#serializer: { enable_annotations: true }
templating:
engines: ['twig']
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
session:
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
handler_id: session.handler.native_file
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
fragments: ~
http_method_override: true
assets:
version: 15
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
form_themes: ["form/fields.html.twig"]
globals:
user: "#app.user"
badges: '#app.sidebar_badges'
paths:
'%kernel.root_dir%/../src/AppBundle/Resources/views': ~
'%kernel.root_dir%/../src/AppBundle/Resources/TwigBundle/views': 'Twig'
It looks like Doctrine is not fully configured in your application. This is likely also why the service can not be found.
Please make sure that inside your AppKernel.php the DoctrineBundle is registered (search for new Doctrine\Bundle\DoctrineBundle\DoctrineBundle()).
Next you will need the doctrine configuration. You can check the repository if you need a reference configuration:
# Doctrine Configuration
doctrine:
dbal:
driver: pdo_mysql
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:
# 1. add the path in parameters.yml
# e.g. database_path: "%kernel.root_dir%/data/data.db3"
# 2. Uncomment database_path in parameters.yml.dist
# 3. Uncomment next line:
# path: "%database_path%"
orm:
auto_generate_proxy_classes: "%kernel.debug%"
naming_strategy: doctrine.orm.naming_strategy.underscore
auto_mapping: true
Also make sure, that your parameters.yml and parameters.yml.dist contain the values needed by the configuration. Again you can take the file from the official repository as a reference.

Symfony2 FosUserBundle is loosing session

I am using FosUserBundle to register and authenticate users in my website. But i am having troubles with it cause user session is loosen very soon. Sometimes 5 minutes, sometimes 10 minutes, and then user is redirected to the login form again, causing many users to left my website.
This is what i currently have in my project:
composer.json
{"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",
"symfony/yaml": "2.7.*#dev",
"symfony/filesystem": "~2.6",
"sensio/distribution-bundle": "~3.0,>=3.0.12",
"sensio/framework-extra-bundle": "~3.0,>=3.0.2",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/user-bundle": "~2.0#dev",
"friendsofsymfony/jsrouting-bundle": "#stable",
"knplabs/knp-snappy-bundle": "dev-master",
"jms/serializer-bundle": "0.13.*"
},
"require-dev": {
"sensio/generator-bundle": "~2.3"
}
}
config.yml
imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: "#MoovityUserBundle/Resources/config/services.yml" }
- { resource: "#MoovityBackendBundle/Resources/config/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: ~
cookie_lifetime: 0
gc_maxlifetime: 14400
fragments: ~
http_method_override: true
# translator: ~
# Twig Configuration
twig:
debug: "%kernel.debug%"
strict_variables: "%kernel.debug%"
# Assetic Configuration
assetic:
debug: "%kernel.debug%"
use_controller: false
bundles: [ MoovityBackendBundle ]
#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 }
fos_user:
db_driver: orm
firewall_name: main
user_class: Moovity\UserBundle\Entity\User
registration:
confirmation:
enabled: true
from_email:
address: noreply#mywebsite.com
sender_name: mywebsite
template: MoovityBackendBundle:Mail:mail_fos_user_register_template.html.twig
# template: FOSUserBundle:Registration:email.html.twig
form:
type: moovity_user_registration
resetting:
email:
from_email:
address: resetpass#mywensite.com
sender_name: My Website Reset Password
template: FOSUserBundle:Resetting:email.html.twig
form:
type: moovity_user_resetting
service:
mailer: fos_user.mailer.twig_swift
#fos_rest:
# routing_loader:
# default_format: json
security.yml
security:
encoders:
FOS\UserBundle\Model\UserInterface: sha512
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: ROLE_ADMIN
providers:
fos_userbundle:
# id: fos_user.user_provider.username
id: fos_user.user_provider.username_email
firewalls:
main:
pattern: ^/
form_login:
login_path: fos_user_registration_register
check_path: fos_user_security_check
provider: fos_userbundle
csrf_provider: form.csrf_provider
# always_use_default_target_path: true
# Redirección despues de loguear
default_target_path: moovity_backend_homepage
logout:
path: fos_user_security_logout
target: fos_user_registration_register
# target: fos_user_security_login
anonymous: true
security: true
remember_me:
key: 57361cdee0bb68f4e4b71f06b28fc07e
lifetime: 6000
What am i doing wrong?
Ok, i have noticed that fosuserbundle is loosing session with Symfony 2.6, so i switched to 2.3 and now it seems to be working.
Thank you very much.
I think the problem is the translation.
Got the same errors, try to remove the locale in your parameter and reset it with ~
Please post if it was the problem

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

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.

Labels are not translated with admin integration of SonataMediaBundle

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.

Compile Error: Declaration of FOS\RestBundle\Request\RequestBodyParamConverter::apply() must be compatible with that of Sensio\Bundle

I'm using symfony2. I'm trying to use the Request Body convert listener from FriendsOfSymfony bundle. I have enabled the request converters on sensio_framework_extra and when enabling the body converter:
fos_rest:
body_converter:
enabled: true
I get this exception:
FatalErrorException: Compile Error: Declaration of FOS\RestBundle\Request\RequestBodyParamConverter::apply() must be compatible with that of Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterInterface::apply() in /var/www/xxx/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/Request/RequestBodyParamConverter.php line 32
in /var/www/xxx/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/Request/RequestBodyParamConverter.php line 32
at ErrorHandler->handleFatalError(object(ExceptionHandler), array('type' => '64', 'message' => 'Declaration of FOS\RestBundle\Request\RequestBodyParamConverter::apply() must be compatible with that of Sensio\Bundle\FrameworkExtraBundle\Request\ParamConverter\ParamConverterInterface::apply()', 'file' => '/var/www/xxx/vendor/friendsofsymfony/rest-bundle/FOS/RestBundle/Request/RequestBodyParamConverter.php', 'line' => '32')) in /var/www/xxx/vendor/symfony/symfony/src/Symfony/Component/Debug/ErrorHandler.php line 212
Here is my full config.yml file
imports:
- { resource: parameters.yml }
- { resource: security.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%"
# 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 }
# Friends of Symfony configuration
fos_rest:
body_converter:
enabled: true
routing_loader:
default_format: json
param_fetcher_listener: true
body_listener: true
format_listener: true
view:
view_response_listener: 'force'
# Sensio Framework Extra Configuration
sensio_framework_extra:
request: { converters: true }
view: { annotations: false }
router: { annotations: false }
and this is my require libraries on composer.json
"require": {
"php": ">=5.3.3",
"symfony/symfony": "~2.4",
"doctrine/orm": "~2.2,>=2.2.3",
"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": "~2.3",
"sensio/framework-extra-bundle": "~3.0",
"sensio/generator-bundle": "~2.3",
"incenteev/composer-parameter-handler": "~2.0",
"friendsofsymfony/rest-bundle": "1.1.0",
"jms/serializer-bundle": "dev-master"
},
anybody has any ideas?
thanks

Categories