symfony-2.7

Form CollectionType with radio buttons fails after Symfony 2.7 upgrade

我的未来我决定 提交于 2019-12-07 07:23:27
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, array or an instance of \ArrayAccess.") in MyBundle:Shipping:form.html.twig at line 8. $builder->add(

Injecting EntityManager-dependend service into Listener

六眼飞鱼酱① 提交于 2019-12-06 06:52:54
问题 I am trying to inject one of my services into an EntityListener in order to call some application specific behaviour when an entity gets updated. My Logger service, used to store events in a LogEntry entity in my database: class Logger { /** * @var EntityManager $manager The doctrine2 manager */ protected $manager; //... } The listener: class EntityListener { public function __construct(Logger $logger) { $this->logger = $logger; // ... } } And the service definitions in my service.yml :

Injecting EntityManager-dependend service into Listener

核能气质少年 提交于 2019-12-04 12:11:51
I am trying to inject one of my services into an EntityListener in order to call some application specific behaviour when an entity gets updated. My Logger service, used to store events in a LogEntry entity in my database: class Logger { /** * @var EntityManager $manager The doctrine2 manager */ protected $manager; //... } The listener: class EntityListener { public function __construct(Logger $logger) { $this->logger = $logger; // ... } } And the service definitions in my service.yml : listener: class: Namespace\EntityListener arguments: [@logger] tags: - { name: doctrine.event_listener,

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

纵饮孤独 提交于 2019-12-04 06:16:26
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) { ... } } /** * @Rest\RouteResource("comment", pluralize=false) */ class CommentController extends FOSRestController {

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

半世苍凉 提交于 2019-12-03 23:50:53
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: ResourceNotFoundException » [2/2] NotFoundHttpException: No route found for "GET /lucky/number" + [1/2]

Symfony 2.7 / 3 - Doctrine: You have requested a non-existent service “fos_user.doctrine_registry”

感情迁移 提交于 2019-12-03 22:10:09
Doing a composer update today suddenly getting the following error: [Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException] You have requested a non-existent service "fos_user.doctrine_registry". when composer is executing the cache:clear --no-warmup command. Search found an answer related to converting from doctrine to MongoDB but the solutions are not working for me. I am using Doctrine. I've tried Fosuserbundle dev-master, dev-master@dev, 2.0.0-alpha1 and 2.0.0-alpha3. Any other suggestions? Composer update was working fine a couple of days ago. Issue created here: https:

How to remove the deprecation warnings in Symfony 2.7?

陌路散爱 提交于 2019-12-02 07:37:25
问题 The dreaded "is deprecated since version 2.6 and will be removed in 3.0" errors that Symfony is outputting all over the logs and console. I've followed all the guidelines I found that claim to solve it, including upgrading sensio/distribution-bundle and putting ~E_USER_DEPRECATED into php.ini Still getting these messages spammed over me. Aside from some hard measures like forking Symfony or overwriting the trigger_error function, what am I missing? php.ini: error_reporting = E_ALL & ~E

How to remove the deprecation warnings in Symfony 2.7?

拈花ヽ惹草 提交于 2019-12-02 05:57:40
The dreaded "is deprecated since version 2.6 and will be removed in 3.0" errors that Symfony is outputting all over the logs and console. I've followed all the guidelines I found that claim to solve it, including upgrading sensio/distribution-bundle and putting ~E_USER_DEPRECATED into php.ini Still getting these messages spammed over me. Aside from some hard measures like forking Symfony or overwriting the trigger_error function, what am I missing? php.ini: error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT bootstrap.php.cache: namespace { error_reporting(error_reporting() & ~E_USER

How filter data inside entity object in Symfony 2 and Doctrine

北慕城南 提交于 2019-12-02 00:31:06
问题 I have two entities: Product and Feature . Product has many other Features (relation one to many). Every Feature has a name and an important status (true if feature is important, false if not). I want to get in TWIG all important features for my product. Solution below is very ugly: Product: {{ product.name }} Important features: {% for feature in product.features %} {% if feature.important == true %} - {{ feature.name }} {% endif %} {% endfor %} So I want to get: Product: {{ product.name }}

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

无人久伴 提交于 2019-12-01 21:04:15
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? 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.com/symfony/symfony-standard (of course you can add the files in your custom .gitignore files) Hope this