symfony-3.4

“Missing value for primary key”

≡放荡痞女 提交于 2019-12-11 16:06:41
问题 I'd just migrated to Symfony 3.4 and had this kind of message : request.CRITICAL: Uncaught PHP Exception Doctrine\Common\Proxy\Exception\OutOfBoundsException: "Missing value for primary key idBen on Lea\PrestaBundle\Entity\EgwContact" at /htdocs/vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/OutOfBoundsException.php line 40 Thanks in advance for your help Here is my entity code for egw_contact : <?php namespace Lea\PrestaBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Doctrine

Redirect to page prior to login form Symfony 3.4 is resolving to liip_imagine route in a custom listener

匆匆过客 提交于 2019-12-11 15:49:14
问题 I'm having problems getting a redirect after login to work in Symfony. It works for some pages but for others, the last_route session variable is being set to a users profile picture that uses the liip_imagine_filter: "last_route" => [ "name" => "liip_imagine_filter", "params" => [ "filter" => "profile_picture" "path" => "frederick-jacobson/5ba60fc93056b.png" ] ] LoginFormAuthenticator: class LoginFormAuthenticator extends AbstractFormLoginAuthenticator { /*...*/ protected function

Symfony 3.4 : Field “montant” is not a valid field of the entity “AppBundle\Entity\Vente” in PreUpdateEventArgs

牧云@^-^@ 提交于 2019-12-11 15:16:40
问题 I'm working into a Symfony 3.4 Project and I get an issue with @HasLifeCycleCallbacks in function preUpdate for my entity Vente.php. So when I update my entity fields, the die('AA') is not fired and I get this error : Field "montant" is not a valid field of the entity "AppBundle\Entity\Vente" in PreUpdateEventArgs. Vente.php: namespace AppBundle\Entity; use Doctrine\ORM\Mapping as ORM; use Symfony\Component\Validator\Constraints as Assert; use AppBundle\Validator\Constraints as Assert2; use

Symfony 3.4 - “no commands defined in the “doctrine:schema” namespace” when attempting to run console command in class

我是研究僧i 提交于 2019-12-11 06:47:25
问题 I'm following along with this blog to create unit tests that use my data fixtures as a base. The relevant code: namespace Tests\AppBundle\Repository; use Symfony\Component\Console\Application; use Symfony\Component\Console\Input\StringInput; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class DataFixtureTestCase extends WebTestCase { protected $client, $container, $em; protected static $application; /** * {@inheritdoc} */ protected function setUp() { self::runCommand('doctrine:schema

'Symfony3' - 'fosuserbundle' form - add group to user

删除回忆录丶 提交于 2019-12-11 06:01:49
问题 I use Symfony 3 with the fosuserbundle , and want to create a form, that will add multiple groups to one user. The layout is not the problem, but to building the form and submitting... Here is the sourcecode with the important parts: https://pastebin.com/tyFP8XGK The current problem is that if I have a user (in my case it is an admin) have any group, I can't add one or more groups and submit without error, BUT if I edit the admin, the groups aren't preselected in the choise, AND if I submit

Symfony Update 2.8 to 3.4

情到浓时终转凉″ 提交于 2019-12-10 08:00:59
问题 I wanted to upgrade my old Symfony project from 2.8 to 4.0 but I stacked at upgrade from 2.8 to 3.4. I used this tutorial for the upgrade Moving to Symfony 3.4. I got some errors while trying to update through composer Composer Upgrade Errors: # php composer.phar update symfony/symfony --with-dependencies Dependency "symfony/polyfill-apcu" is also a root requirement, but is not explicitly whitelisted. Ignoring. Dependency "twig/twig" is also a root requirement, but is not explicitly

symfony: How to set configuration parameters files for different environments?

百般思念 提交于 2019-12-08 20:16:22
问题 How to setup a different configuration parameters file for each environment? At the moment parameters in parameters.yml are used in both dev and prod environment, but I need different parameters in order to deploy my app in prod. 回答1: You can put all the parameters used in your dev environment in a app\config\parameters_dev.yml file ( you need to create it ) and then import it in your app\config\config_dev.yml : imports: - { resource: config.yml } - { resource: parameters_dev.yml } So when

TearDown database after a phpUnitTest on a WebTestCase using DataFixtures

一笑奈何 提交于 2019-12-08 04:25:32
I have the following phpUnit functional Test: namespace Tests\AppBundle\Controller; /** * @testtype Functional */ class DefaultControllerTest extends BasicHttpController { /** * {@inheritdoc} */ public function setUp() { $client = static::createClient(); $container = $client->getContainer(); $doctrine = $container->get('doctrine'); $entityManager = $doctrine->getManager(); $fixture = new YourFixture(); $fixture->load($entityManager); } /** * {@inheritdoc} */ public function tearDown() { //Database is being destroyed here.... } public function testIndex() { $client = static::createClient();

TearDown database after a phpUnitTest on a WebTestCase using DataFixtures

天涯浪子 提交于 2019-12-08 04:21:40
问题 I have the following phpUnit functional Test: namespace Tests\AppBundle\Controller; /** * @testtype Functional */ class DefaultControllerTest extends BasicHttpController { /** * {@inheritdoc} */ public function setUp() { $client = static::createClient(); $container = $client->getContainer(); $doctrine = $container->get('doctrine'); $entityManager = $doctrine->getManager(); $fixture = new YourFixture(); $fixture->load($entityManager); } /** * {@inheritdoc} */ public function tearDown() { /

Cannot autowire service FOSUserBundle, Symfony 3.4

喜欢而已 提交于 2019-12-06 05:57:52
问题 I'm trying to override the registration controller of my FOSUserBundle. I've followed the steps on https://symfony.com/doc/3.4/bundles/inheritance.html But I get the following error: Cannot autowire service "AppBundle\Controller\RegistrationController": argument "$formFactory" of method "FOS\UserBundle\Controller\RegistrationController::__construct()" references interface "FOS\UserBundle\Form\Factory\FactoryInterface" but no such service exists. You should maybe alias this interface to one of