symfony-2.7

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

Every parent controller must have `get{SINGULAR}Action($id)` method when i have multi level sub resource in FOS Rest Bundle

只愿长相守 提交于 2020-01-01 09:33:14
问题 I have three controller named BlogController , PostController , CommentController that CommentController is sub resource of PostController and PostController sub resource of BlogController . /** * @Rest\RouteResource("blog", pluralize=false) */ class BlogController extends FOSRestController { public function getAction($blogUri) { ... } } /** * @Rest\RouteResource("post", pluralize=false) */ class PostController extends FOSRestController { public function getAction($postId) { ... } } /** *

Should the changes of SymfonyRequirements.php be included in version control?

江枫思渺然 提交于 2019-12-31 01:22:08
问题 After running composer update , I got app/SymfonyRequirements.php is updated in my working changes of my symfony 2.7@beta application. What is that file? Should I commit the changes of the file? 回答1: The files is used in the check CLI tool that use this files for control the minimal Requirements for Running Symfony. You can find more info in the doc. Usually is take into account in a version control system, as you can see in the symfony-standard distribution project on github: https://github

Application works in app_dev.php, but not visible using app.php

无人久伴 提交于 2019-12-24 12:21:54
问题 I am really confused. I am using Symfony 2.7 and doctrine as its native ORM. So everything works as it is supposed to work when I start it using app_dev.php, but when I start it using app.php. It just doesn't work. In logs it says [2017-11-27 09:02:51] request.CRITICAL: Uncaught PHP Exception Doctrine\DBAL\DBALException: "An exception occurred while executing 'SELECT t1.id AS id2, t1.code AS code3, t1.created AS created4, t1.updated AS updated5, t1.template_code AS template_code6, t1.label

Form CollectionType with radio buttons fails after Symfony 2.7 upgrade

青春壹個敷衍的年華 提交于 2019-12-23 02:39:31
问题 Getting below error.. An exception has been thrown during the rendering of a template ("The form's view data is expected to be of type scalar, array or an instance of \ArrayAccess, but is an instance of class Proxies__CG__\BLA\MyBundle\Entity\TransportType. You can avoid this error by setting the "data_class" option to "Proxies__CG__\BLA\MyBundle\Entity\TransportType" or by adding a view transformer that transforms an instance of class Proxies__CG__\BLA\MyBundle\Entity\TransportType to scalar

Form CollectionType with radio buttons fails after Symfony 2.7 upgrade

∥☆過路亽.° 提交于 2019-12-23 02:39:11
问题 Getting below error.. An exception has been thrown during the rendering of a template ("The form's view data is expected to be of type scalar, array or an instance of \ArrayAccess, but is an instance of class Proxies__CG__\BLA\MyBundle\Entity\TransportType. You can avoid this error by setting the "data_class" option to "Proxies__CG__\BLA\MyBundle\Entity\TransportType" or by adding a view transformer that transforms an instance of class Proxies__CG__\BLA\MyBundle\Entity\TransportType to scalar

Symfony2: No route found for “GET /lucky/number”

我是研究僧i 提交于 2019-12-21 06:50:39
问题 I start the tutorial (as newbie) and everythings works fine till: http://symfony.com/doc/current/book/page_creation.html#creating-a-page-route-and-controller at step Creating a Page: Route and Controller I have created a file called /var/www/html/[projekt]/src/AppBundle/Controller/LuckyController.php but when I open http://[Server-IP]:8000/app_dev.php/lucky/number is always get a 404: No route found for "GET /lucky/number" 404 Not Found - NotFoundHttpException 1 linked Exception:

Compile Error: Cannot use isset() on the result of an expression

本秂侑毒 提交于 2019-12-17 20:17:50
问题 I'm getting this error in a app I am migrating from SF2.0.x to SF2.7: [1] Symfony\Component\Debug\Exception\FatalErrorException: Compile Error: Cannot use isset() on the result of an expression (you can use "null !== expression" instead) at n/a in /var/www/html/reptooln_admin/app/cache/dev/twig/68/7f/63589dd3687cb849dd68e6b6c10aa99eda1d82f95a5f3ac52a864d200499.php line 39 I don't know what is failing or how to fix this so I need some advise. This is the line at cache file where the Stacktrace

SYMFONY3 in prod look for TWIG template in wrong folder instead of custom bundle indicated in routing.yml and AppKernel.php

故事扮演 提交于 2019-12-12 06:05:22
问题 I am implementing a SYMFONY 3 project in production mode for the first time. I follow OceanDigital tutorial and the standard doc. I went thru a bunch of issues linked to user writing rights that I've solved, and I do get now a SYMFONY ERROR page (one step closer to victory) with this message: Unable to find template "MyBundle:std_page:home.html.twig" (looked into: /[folder to symf project]/app/Resources/views, /[folder to symf project]/vendor/symfony/symfony/src/Symfony/Bridge/Twig/Resources

How do I check if object was found in a Doctrine2 repository?

人走茶凉 提交于 2019-12-10 13:00:03
问题 I am finding a entity by its PK as follow: $ent = $em->getRepository('AppBundle:Representative')->find($id) What is the right way to check whether $ent is a real Representative object or not? What I mean with real is that $ent currently exists on DB and was returned since I am planning to use the same results for INSERT and UPDATE . In pseudo-code what is on my head is: if (ent is Representative) { // Update its values } else { // Create a new Representative } I was thinking in use is_object(