symfony-3.3

Symfony3 : multi-steps form and flush after forward

家住魔仙堡 提交于 2019-12-11 07:32:21
问题 I have a form to add a new prescriber in my database. The first step consists in informing the various informations about the prescriber. Then, I check if there are similar prescribers before adding it (2nd step with a 2nd form) and if there are, I ask the user to confirm. In short, I have a 1-step form or a 2-steps form, depending on duplicates. I tried with CraueFormFlowBundle but I don't know how to implement my conditional second step. My tests were inconclusive. So I decided to use

Symfony Controller unable to access container

此生再无相见时 提交于 2019-12-11 05:00:02
问题 So I've done a new install of Symfony 3, trying to setup a few API routes, but I am unable to access the container inside my controllers. My controller extends from the base Symfony controller, which has the ContainerAwareTrait , but when I try doing $this->container->get('service') I am getting this error: "message": "Call to a member function get() on null", "class": "Component\\Debug\\Exception\\FatalThrowableError", "trace": [{ "namespace": "", "short_class": "", "class": "", "type": "",

Symfony 3 sharing cookies across sub-domains?

别来无恙 提交于 2019-12-10 13:29:24
问题 I want to share a cookie across any subdomain. This should then allow me to keep the session. I am using the Symfony framework version 3.0. I've read that you should set the following: ## app/config/config.yml session: cookie_domain: .localhost I tried multiple variations on this but none of them change anything. the domain associated with the cookie won't change. Any ideas how this should be done?? What am I missing. 回答1: To be sure you need to delete your cookie and log back. session:

Connection to a db with Doctrine pdo_sqlsrv

隐身守侯 提交于 2019-12-07 16:02:27
I'm trying to connect to my database in SQL Server 2000, but i get an error could not find driver when i'm using pdo_sqlsrv. But if i use sqlsrv i get an error Attempted to call function "sqlsrv_configure" from namespace "Doctrine\DBAL\Driver\SQLSrv". Here is my config.yml config.yml doctrine: dbal: default_connection: default connections: default: dbname: "%database_name%" user: "%database_user%" password: "%database_password%" host: "%database_host%" driver: pdo_mysql charset: utf8mb4 default_table_options: charset: utf8mb4 collate: utf8mb4_unicode_ci connection2: dbname: "%database_name2%"

ng serve Unable to find “@angular/cli” in devDependencies

折月煮酒 提交于 2019-12-06 13:43:15
问题 $ ng serve Unable to find "@angular/cli" in devDependencies. Please take the following steps to avoid issues: "npm install --save-dev @angular/cli@latest" You seem to not be depending on "@angular/core". This is an error. in the backend(symfony) is run corretly but I had this error in angular js frontend when i want to run my server can someone have a idea why and how i solve 回答1: This may happen if you aren't in you root directory of your application. This can happen if you created a new

Symfony 3.3 injecting repositories into services

柔情痞子 提交于 2019-12-05 12:50:18
I have a bundle which is held in a private Satis repository as its entities and repositories are shared between multiple application. The rest of the applications that consume that bundle are Symfony 2.7 and 2.8 applications. I'm working on a new application and the requirement is to use Symfony 3.3. In the symfony 3.3 application I have tried this in my services.yml: # Learn more about services, parameters and containers at # http://symfony.com/doc/current/service_container.html parameters: #parameter_name: value services: # default configuration for services in *this* file _defaults:

ng serve Unable to find “@angular/cli” in devDependencies

ε祈祈猫儿з 提交于 2019-12-04 20:17:27
$ ng serve Unable to find "@angular/cli" in devDependencies. Please take the following steps to avoid issues: "npm install --save-dev @angular/cli@latest" You seem to not be depending on "@angular/core". This is an error. in the backend(symfony) is run corretly but I had this error in angular js frontend when i want to run my server can someone have a idea why and how i solve This may happen if you aren't in you root directory of your application. This can happen if you created a new project with the command ng new project-name and then try to run serve command without actually entering the

Symfony 3.3 services autoconfiguration

六月ゝ 毕业季﹏ 提交于 2019-12-04 05:43:36
I'm trying migrate to symfony 3.3 and use new feature autowire / autoconfigure services: So in services.yml i have: services: _defaults: autowire: true autoconfigure: true public: false # makes classes in src/AppBundle available to be used as services AppBundle\: resource: '../../src/AppBundle/*' # you can exclude directories or files # but if a service is unused, it's removed anyway exclude: '../../src/AppBundle/{Entity,Controller,DQL,Form/DataTransformer,Repository}' i declare my twig extension as: AppBundle\Twig\ImageExtension: arguments: $env: "%kernel.environment%" and constructor for

Is there a way to inject EntityManager into a service

假如想象 提交于 2019-11-30 21:03:20
While using Symfony 3.3 , I am declaring a service like this: class TheService implements ContainerAwareInterface { use ContainerAwareTrait; ... } Inside each action where I need the EntityManager, I get it from the container: $em = $this->container->get('doctrine.orm.entity_manager'); This is a bit annoying, so I'm curious whether Symfony has something that acts like EntityManagerAwareInterface . Traditionally, you would have created a new service definition in your services.yml file set the entity manager as argument to your constructor app.the_service: class: AppBundle\Services\TheService