symfony-2.4

StofDoctrineExtension Tree entity: get the id of the parent in twig

◇◆丶佛笑我妖孽 提交于 2019-12-12 01:04:27
问题 I'm using DoctrineExtensions Tree for my entity account. I'm getting my results with the following: $repo = $em->getRepository('NRtworksChartOfAccountsBundle:Accounttree'); $arrayTree = $repo->childrenHierarchy(); Entity Accounttree is the classic entity following the doc: /** * @Gedmo\Tree(type="nested") * @ORM\Table(name="Accounttree") * use repository for handy tree functions * @ORM\Entity(repositoryClass="Gedmo\Tree\Entity\Repository\NestedTreeRepository") */ class Accounttree { /** *

Symfony 2 forms with validation groups, errors mapped to the wrong property?

半世苍凉 提交于 2019-12-11 02:26:39
问题 Never had this problem before. Fill the form with a phone, leaving lastname blank Submit the form (and the validation groups become Default and Create ) The error "Last name is required." is mapped on the wrong $phone field, while should be mappend to $lastName itself property Can you reproduce the same issue? $phone property is in the Create validation group, while $phone in Default implicit group: class User { /** * @Assert\NotBlank(groups={"Create"}, message="Last name is required.") * *

Symfony: InvalidArgumentException while parsing web.xml

别说谁变了你拦得住时间么 提交于 2019-12-08 18:48:23
问题 Recently I moved a Symfony-system to another Server and got an error ever since. The technical details are: An apache 2.4 server on a windows server 2012 A fileserver which can be accessed by apache over the local network When I moved the Symfony-page I deleted the cache. What happens now is, that I get these error-messages: InvalidArgumentException: Unable to parse file "\\FILESERVER\PAGEPATH\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\DependencyInjection/../Resources/config

How to resolve ServiceCircularReferenceException?

夙愿已清 提交于 2019-12-07 18:23:30
问题 I wanted to inject the current user into an Entity Listener but I ran into an ServiceCircularReferenceException . I know there are other questions dealing with this issue, and one mentioned solution was to inject the entire service_container into the listener, which didn't work. I then stumbled accross a seemingly duplicate question, where the provided accepted answer was to implement a UserCallable. But this again yields in the exact same exception. Could it be that it is due to my

How to resolve ServiceCircularReferenceException?

耗尽温柔 提交于 2019-12-05 18:38:06
I wanted to inject the current user into an Entity Listener but I ran into an ServiceCircularReferenceException . I know there are other questions dealing with this issue, and one mentioned solution was to inject the entire service_container into the listener, which didn't work. I then stumbled accross a seemingly duplicate question , where the provided accepted answer was to implement a UserCallable. But this again yields in the exact same exception. Could it be that it is due to my dependency of the FOSUserBUndle? How can I fix this? The exception: [Symfony\Component\DependencyInjection

Access global parameters from route condition expressions in Symfony

混江龙づ霸主 提交于 2019-12-04 12:31:25
I'm trying to access app-wide symfony parameters (defined in app/config/parameters.yml) from an expression in a route condition ( documentation ). I tried my luck inserting the parameter within percentage signs and through the function "parameter" (as described for DI here ), both to no avail. Here is the example with the parameter function: example_route: path: /example/{_locale} condition: "request.getLocale() in parameter('locales_array')" defaults: _controller: "AcmeExampleBundle:Example:index" _locale: %locales_default% However I'm getting: SyntaxError - The function "parameter" does not

datagrid filter for relation object as text field (insted of dropdown) in sonata admin in symfony 2.4

主宰稳场 提交于 2019-12-04 06:41:22
I have entity 'Action' with relation to 'User'. Created Admin CRUD controller in SonataAdminBundle. Everything works fine except user filter is rendered as dropdown list. I have 8k user count and growing so you must see why this is a problem. I want user filter to be text input and on submit to search with LIKE %username% Right now I add user filter like this - $datagridMapper->add('user') . I know I can add filter type and field type but I am not able to find the right combination and options. Found information on http://sonata-project.org/bundles/doctrine-orm-admin/master/doc/reference

Updating Symfony 2.4 : “Rendering a fragment can only be done when handling a Request.”

丶灬走出姿态 提交于 2019-12-02 02:44:49
问题 Since I migrated to Symfony 2.4, I'm getting the following error message : Rendering a fragment can only be done when handling a Request. It's happening because, on some pages, I'm rendering some templates with Twig inside some pages which are handled by another older framework, by doing $sf2->container->get('twig')->render("MyBundle::my-template.html.twig"); . So yes, that's right that Symfony 2 isn't handling those requests, but I still want to render those templates with Twig ! Why can't I

Inherit form or add type to each form

笑着哭i 提交于 2019-11-29 06:38:04
I am searching for an easy way to add a bundle of fields to each form. I have found a way to extend the AbstractType and use the buildForm method to add more fields. When creating the form I give the name of my new type ( How to Create a Custom Form Field Type ). In my opinion it is an easy way, but it is restricted to one type per form. Is there a better way to achieve anything like that? I have read the cookbook of symfony, but I have only found stuff how to extend an existing form not how to create an own form "template" with my fields. Have you tried using inheritance? This is really

FOSUserBundle Override Roles - Property “roles” in “Acme\\DemoBundle\\Entity\\User” was already declared, but it must be declared only once

安稳与你 提交于 2019-11-28 22:10:54
I like most people are trying to override the FOSUserBundle roles so I can map them ManyToMany to a Role Entity. Unfortunately for some reason due to the mapping of the Model/User I get the following: Property "roles" in "Acme\DemoBundle\Entity\User" was already declared, but it must be declared only once There seems to be some workaround mentioned in this git issue posted in FOSUserBundle: https://github.com/FriendsOfSymfony/FOSUserBundle/pull/1081#issuecomment-19027818 I am Doctrine ORM and using Annotations for mapping not yml or xml. Latest Symfony (2.4) and latest FOSUB. I tried the