We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hey there,
When i create my Client via loginAs and a Reference it will later, when i want to edit this user, into a duplicate entry.
FYI: I´m using FOSUserBundle.
What i do:
User Create:
$userManager = $this->container->get('fos_user.user_manager'); $user = new User(); $user->setUsername("myname"); $user->setEmail("[email protected]"); $user->setPlainPassword("testpass"); $user->setEnabled(true); $userManager->updateCanonicalFields($user); $userManager->updatePassword($user); $this->addReference('user-default', $user); $userManager->updateUser($user);
Fixtures Load (LiipFunctionalTestBundle)
$em = $this->getContainer()->get('doctrine')->getManager(); if (!isset($metadatas)) { $metadatas = $em->getMetadataFactory()->getAllMetadata(); } $schemaTool = new SchemaTool($em); $schemaTool->dropDatabase(); if (!empty($metadatas)) { $schemaTool->createSchema($metadatas); } $fixturesClasses = array( LoadUserData::class ); $this->fixtures = $this->loadFixtures($fixturesClasses)->getReferenceRepository();
Client Create:
$currentUser = $this->fixtures->getReference("user-default"); $this->loginAs($currentUser, $fireWall); $this->client = $this->makeClient();
User Update in Controller:
$user = $this->get('security.token_storage')->getToken()->getUser(); if ($user instanceof User) { $user->setlastActionAt(new \DateTime()); $this->em->persist($user); $this->em->flush(); // results in a Integrity constraint violation: 1062 Duplicate entry }
What i recognized is that the getEntityState in the UnitOfWork results in $assume, because the $this->entityStates is empty.
What i´m doing wrong? Or is it a bug?
Thanks, Thomas
The text was updated successfully, but these errors were encountered:
When you perform the same things by yourself (i.e. by going to app_dev.php/…), do you have the same error?
app_dev.php/…
Sorry, something went wrong.
What do you exactly mean with "same things"? Just the "User Update in Controller"? That works.
By the way: if i do a makeClient with username and password credentials, everything is working fine.
No branches or pull requests
Hey there,
When i create my Client via loginAs and a Reference it will later, when i want to edit this user, into a duplicate entry.
FYI: I´m using FOSUserBundle.
What i do:
User Create:
Fixtures Load (LiipFunctionalTestBundle)
Client Create:
User Update in Controller:
What i recognized is that the getEntityState in the UnitOfWork results in $assume, because the $this->entityStates is empty.
What i´m doing wrong? Or is it a bug?
Thanks,
Thomas
The text was updated successfully, but these errors were encountered: