symfony-3.3

Symfony Twig {{render}} handling passed arguments

邮差的信 提交于 2019-12-24 16:34:04
问题 Over a template I do a render method: {{ render(controller('AppBundle:Widgets:myCapsWidget'),{'somestring':someString}) }} Over the controller I have the following method: public function myCapsWidgetAction($somestring) { return new Response(strtoupper($somestring)); } I also looked over theese links: symfony twig render controller argument array https://knpuniversity.com/screencast/symfony2-ep3/render-controller But still cannot find any light to my path. 回答1: If I read the first link you

“enable_annotations on the validator cannot be set as Annotations support is disabled” in symfony

主宰稳场 提交于 2019-12-24 14:25:38
问题 I just created a bundle (successfully), and when I am about to create an entity via console this happened(also with clear:cache): [LogicException] "enable_annotations" on the validator cannot be set as Annotations support is disabled. mi config.yml looks like framework: validation: { enable_annotations: true } serializer: { enable_annotations: true } when i comment the options for validation throws the same Exception but with the serializer when i comment both then it becomes a

symfony 3.3 custom router

拥有回忆 提交于 2019-12-24 09:28:29
问题 I have an application, which is dual accessible through login and an OAuth client secret with the same routes. For Oauth access I need to pass a url parameter: "access_token" around on all urls. It seems best to achieve this with a custom router: app/config/services.yml # Learn more about services, parameters and containers at # https://symfony.com/doc/current/service_container.html parameters: router.class: AppBundle\Routing\AccessTokenRouter services: # default configuration for services in

Symfony 3.3 - Entity Manager injection into services with multiple database?

拟墨画扇 提交于 2019-12-24 09:07:48
问题 I have recently added a new database to my Symfony 3.3 application. Then my services with injected entity manager are no longer working and return the following error: Cannot autowire service "RouterBundle\Utils\RoutersUtils": argument "$em" of method "__construct()" references class "Doctrine\ORM\EntityManager" but no such service exists. Try changing the type-hint to one of its parents: interface "Doctrine\ORM\EntityManagerInterface", or interface "Doctrine\Common\Persistence\ObjectManager"

Symfony 3.3 injecting repositories into services

我与影子孤独终老i 提交于 2019-12-22 08:01:25
问题 I have a bundle which is held in a private Satis repository as its entities and repositories are shared between multiple application. The rest of the applications that consume that bundle are Symfony 2.7 and 2.8 applications. I'm working on a new application and the requirement is to use Symfony 3.3. In the symfony 3.3 application I have tried this in my services.yml: # Learn more about services, parameters and containers at # http://symfony.com/doc/current/service_container.html parameters:

Is there a way to inject EntityManager into a service

折月煮酒 提交于 2019-12-19 03:19:11
问题 While using Symfony 3.3 , I am declaring a service like this: class TheService implements ContainerAwareInterface { use ContainerAwareTrait; ... } Inside each action where I need the EntityManager, I get it from the container: $em = $this->container->get('doctrine.orm.entity_manager'); This is a bit annoying, so I'm curious whether Symfony has something that acts like EntityManagerAwareInterface . 回答1: Traditionally, you would have created a new service definition in your services.yml file

FOSUser on Symfony 3.3

半城伤御伤魂 提交于 2019-12-13 07:30:30
问题 This is similar to Symfony3 You have requested a non-existent service "validator.builder", while add FOSUserBundle, on vanilla Symfon3.3 instead of microkernel (in case that makes differences). Problem: I have a problem trying to set up FOSUser (v.2) on a Symfony 3.3: [Symfony\Component\DependencyInjection\Exception\AutowiringFailedException] Cannot autowire service "validator.builder": argument "$node" of method "Symfony\Component\Config\Definition\Builder\ValidationBuilder::__construct()"

Symfony 3 micro kernel and ORM

独自空忆成欢 提交于 2019-12-13 07:27:28
问题 I've using Micro Kernel and I tried to configure Doctrine ORM. app/config/config.yml framework: secret: S0ME_SECRET templating: engines: ['twig'] profiler: { only_exceptions: false } doctrine: dbal: driver: pdo_mysql host: 127.0.0.1 dbname: symfony-micro user: root password: '' orm: app/AppKernel.php use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component

Symfony-Catchable Fatal Error: Argument 1 passed to Doctrine\Common\Collections\ArrayCollection::__construct() must be of the type array, object given [closed]

主宰稳场 提交于 2019-12-11 17:43:15
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed last year . I am getting this error while trying to load my page(Symfony 3.3): Catchable Fatal Error: Argument 1 passed to Doctrine\Common\Collections\ArrayCollection::__construct() must be of the type array, object given`. I have looked at many websites but none of them was able to solve my problem. Below is an example of my

Specify different validation groups for each item of a collection in Symfony 3?

谁说胖子不能爱 提交于 2019-12-11 08:47:33
问题 I have a project entity which has many images, every image has title, imageFile attributes I want the user to be able to add, update and delete images from the project form. The problem is that the projectImage entity validation groups when it is new should be different from when it is being edited. and this is the code ProjectType class ProjectType extends AbstractType { /** * @param FormBuilderInterface $builder * @param array $options */ public function buildForm(FormBuilderInterface