symfony-2.4

Symfony2: ContextErrorException: Catchable Fatal Error: Argument 1 passed to […]::__construct() must implement interface […] none given

淺唱寂寞╮ 提交于 2020-01-30 11:21:26
问题 The problem: Any time I try to access the application I get this error: ContextErrorException: Catchable Fatal Error: Argument 1 passed to PL\OrderBundle\Entity\OrderHasComment::__construct() must implement interface Symfony\Component\Security\Core\SecurityContextInterface, none given, called in /var/www/html/apps/portal_de_logistica/vendor/sonata-project/doctrine-orm-admin-bundle/Model/ModelManager.php on line 416 and defined in /var/www/html/apps/portal_de_logistica/src/PL/OrderBundle

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

蹲街弑〆低调 提交于 2020-01-12 19:00:13
问题 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

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

半世苍凉 提交于 2020-01-12 18:59:13
问题 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

Symfony2.4 form 'This form should not contain extra fields' error

时光毁灭记忆、已成空白 提交于 2020-01-09 10:41:46
问题 I'm trying to build app based on REST api ang AngularJS. I've been following this tutorial http://npmasters.com/2012/11/25/Symfony2-Rest-FOSRestBundle.html but have to change some details ( depreciated methods ) and right now when I post to create new entity I get 'This form should not contain extra fields' error. class MainController extends Controller { public function indexAction(Request $request) { $form = $this->createForm(new TaskType(),null,array('action' => $this->generateUrl('post

Symfony2.4 form 'This form should not contain extra fields' error

二次信任 提交于 2020-01-09 10:41:18
问题 I'm trying to build app based on REST api ang AngularJS. I've been following this tutorial http://npmasters.com/2012/11/25/Symfony2-Rest-FOSRestBundle.html but have to change some details ( depreciated methods ) and right now when I post to create new entity I get 'This form should not contain extra fields' error. class MainController extends Controller { public function indexAction(Request $request) { $form = $this->createForm(new TaskType(),null,array('action' => $this->generateUrl('post

Symfony2 and MVC - Is extend controller a good practice?

杀马特。学长 韩版系。学妹 提交于 2019-12-24 02:09:27
问题 I have a simple and perhaps stupid question. Using Symfony2 PHP framework i often work extending controllers like below ( of course it depends from the kind of work ): class MainController extends Controller{ private $locale = array(); protected function Locale() { $em = $this->getDoctrine() ->getManager(); $this->locale = $em->getRepository('CommonLanguageBundle:Language') ->findBy( array('code' => $this->getRequest() ->getLocale() ) ); // \Doctrine\Common\Util\Debug::dump($this->locale);

Symfony2 FOSElasticaBundle update index for all entities related to the entity updated

守給你的承諾、 提交于 2019-12-18 12:21:05
问题 I'm using FOSElasticaBundle and Doctrine in my project, and my code works for the selective index update using the Doctrine lifecycle events. The issue I come up against is if I an update a related entity separately. For example a person may be related to a company through a manytomany relationship. If I update the company name through company entity directly, then indexes for the person related to the company will be out of date and still relate to the company's old name. I'm a bit lost as

Angularjs + Symfony2 routing can't make it work

跟風遠走 提交于 2019-12-13 04:24:21
问题 I've been learning AngularJS and I'd like to integrate it with my SF2 back end. I'm getting confuse with the routes let's see what I have: When we go onto /usermanager the symfony routing system opens a controller that loads a twig template. In this template, I load all the js components needed for angular and do this: {% extends '::base.html.twig' %} {% block javascripts %} {{ parent() }} <script type="text/javascript" src="{{ asset('js/UserManager_Angular.js')}}"></script> {% endblock %} {%

Access global parameters from route condition expressions in Symfony

心不动则不痛 提交于 2019-12-12 08:57:19
问题 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