symfony-2.6

Symfony security.password_encoder isPasswordValid is returning empty

孤者浪人 提交于 2020-02-05 02:51:09
问题 In Symfony 2.6, I am using the following method to encode my password. The password is successfully encoded and saved in the DB. $encoder = $this->container->get('security.password_encoder'); $encodedPwd = $encoder->encodePassword($adminUser, $plainPassword); When I try to validate the user supplied password provided in the login form as follows: $adminUser = $this->getDoctrine()->getManager()->getRepository("AcmeUserBundle:AdminUser")->findOneBy(array('username' => $_username)); $_password =

find user by username from multiple providers [symfony2]

人盡茶涼 提交于 2020-01-26 04:11:48
问题 I need to find a user object in symfony2 based on the username or emailadres. This is not for loggin in, but for other actions on a user. I can simply request the (Doctrine2) repository and call the method loadByUsername from the UserProviderInterface that is on my repository-class. But the code that needs to do this will be used in multiple projects and I need it to be a bit more generic. The user class/table might be different or the users might come from a completely different type of

How to get Container object from LifecycleEventArgs of postLoad in Entity?

南楼画角 提交于 2020-01-13 06:04:34
问题 I'm trying to inject the Container object (which is available in controllers) into an Entity using postLoad lifecycleCallbacks . The argument to the postLoad method is LifecycleEventArgs . I could see the container property (which I want to retrieve) in EventManager of LifecycleEventArgs according to the dump output, but it seems to be a private property and there is no getContainer() method in EventManager . The below is my code. service.yml services: ibw.jobeet.entity.job.container_aware:

TokenStorage sometimes returns null in Service

谁说我不能喝 提交于 2019-12-30 17:21:52
问题 I have a Service that get's the current logged in user, which only works some of the time whilst in the dev environment. The problem seems to be whenever I change the Twig templates and refresh I get the error: Error: Call to a member function getUser() on null If I refresh the page everything works as it should until I update the Twig template again. This obviously makes development very slow as I'm constantly refreshing the page. Things I have done so far:- Cleared the dev environment cache

How to remove fields from the admin user create page of Sonata User Bundle?

五迷三道 提交于 2019-12-29 09:50:11
问题 I have installed Sonata Admin Bundle and User Bundle in my Symfony 2.6 application. I found that the User bundle creates a bundle at src/Application/Sonata/UserBundle . When I go to the admin user creation page ( admin/sonata/user/user/create ), I found a lot of fields there: General Username E-Mail-Address Plain password Groups Profile Date of birth Firstname Lastname Website Biography Gender Locale Timezone Phone Social Facebook Uid Facebook Name Twitter Uid Twitter Name Google+ Uid Google+

How to right insert or update on same Doctrine2 object

丶灬走出姿态 提交于 2019-12-25 18:28:54
问题 I have this piece of code: $entity = $em->getRepository('AppBundle:Representative')->find($soqlObj1['records'][0]['Id']); if ($entity === null) { $entity = new Representative(); $em->persist($entity); } // we set the values from veeva $entity->setVeevaRepId($soqlObj1['records'][0]['Id']); $entity->setEmail($soqlObj1['records'][0]['Email']); ... $em->flush(); And this is part of the entity Representative : class Representative { /** * @ORM\Id() * @ORM\Column(type="string", length=45, nullable

Success handler not working after Symfony2 login

笑着哭i 提交于 2019-12-24 03:43:14
问题 The goal is to do something after authentication success in Symfony2. In order to do that I have extended AuthenticationSuccessHandlerInterface creating a service for the form login in order to be its success handler. Here is the firewall in the security.yml file (where the success handler is declared): firewalls: main: pattern: ^/ form_login: check_path: fos_user_security_check provider: fos_userbundle csrf_provider: form.csrf_provider success_handler: foo_user.component.authentication

Success handler not working after Symfony2 login

霸气de小男生 提交于 2019-12-24 03:43:07
问题 The goal is to do something after authentication success in Symfony2. In order to do that I have extended AuthenticationSuccessHandlerInterface creating a service for the form login in order to be its success handler. Here is the firewall in the security.yml file (where the success handler is declared): firewalls: main: pattern: ^/ form_login: check_path: fos_user_security_check provider: fos_userbundle csrf_provider: form.csrf_provider success_handler: foo_user.component.authentication

Symfony 2.6 error after using composer: “Vendor libraries must be installed”

青春壹個敷衍的年華 提交于 2019-12-23 11:58:10
问题 After creating or updating a Symfony 2.6.1 project with composer, I get a "Vendor libraries must be installed" error and it suggests running php composer.phar install to install them. The exact steps I'm taking:- composer create-project symfony/framework-standard-edition my_new_project/ cd my_new_project This appears to run without any problems, and as far as I can tell, does download all the necessary vendor packages. However if I then run:- php app/check.php This results in:- * Vendor

Symfony2 and Doctrine2: No identifier/primary key specified for Entity “X”. Every Entity must have an identifier/primary key

[亡魂溺海] 提交于 2019-12-12 16:22:17
问题 I'm using Symfony2 to create some dummy projects. I'm keeping to the Symfony2 Book documentation to create an Entity with Doctrine command line (http://symfony.com/doc/current/book/doctrine.html#add-mapping-information). I'm using, thus, annotations, the plain entity Product and no associations. I've copied the exact example: I've successfully created the database and created the table Product. Then, I've removed everything and tried to recreate the database (everything's fine) and the table