symfony-2.8

Generating forms with Symfony 2.8 throws a Twig_Error_Runtime

旧城冷巷雨未停 提交于 2019-12-19 05:04:26
问题 Since the last LTS version of Symfony was released few days ago (30.11.2015) I started playing with it. Unfortunately I can't generate a CRUD with write actions with the same code that works fine in Symfony 2.7.7. First I create a new Symfony project using the bash under Linux Mint 17.2: symfony new tasks lts The new directory tasks gets created with a new Symfony 2.8.0 project inside. After adapting the database credentials in app/config/parameters.yml I create the database: app/console

Generating forms with Symfony 2.8 throws a Twig_Error_Runtime

只愿长相守 提交于 2019-12-19 05:04:22
问题 Since the last LTS version of Symfony was released few days ago (30.11.2015) I started playing with it. Unfortunately I can't generate a CRUD with write actions with the same code that works fine in Symfony 2.7.7. First I create a new Symfony project using the bash under Linux Mint 17.2: symfony new tasks lts The new directory tasks gets created with a new Symfony 2.8.0 project inside. After adapting the database credentials in app/config/parameters.yml I create the database: app/console

Symfony 2.8 dynamic ChoiceType options

。_饼干妹妹 提交于 2019-12-18 11:33:42
问题 in my project I have some forms with choice types with a lot of options. So I decided to build an autocomplete choice type based on jquery autocomplete, which adds new <option> HTML elements to the original <select> on runtime. When selected they are submitted correctly, but can't be handled within the default ChoicesToValuesTransformer , since the don't exist in my form when I create it. How can I make symfony accept my dynamically added values? I found this answer Validating dynamically

Array not in array for doctrine query

喜夏-厌秋 提交于 2019-12-13 04:08:04
问题 I need to use a condition like array is not in array. I have array which one has two element for search. For example (3,1) NOT IN ((2,3),(1,3),(1,32)) it's work as SQL query in phpmyadmin. But not worked as doctrine query. $em = $this->getDoctrine()->getManager(); $qb = $em->getRepository('FangoUserBundle:User') ->createQueryBuilder('user') ->leftJoin('user.collabInvitationTarget', 'invite') ->where('(:currentUserId, user.id) NOT IN (:inviteArr)') ->setParameter('currentUserId', $this-

cascading manytomany relationship symfony insertion and edit

亡梦爱人 提交于 2019-12-13 04:02:00
问题 i'm here searching for your help, and i hope i can find some help i have a cascading manytomany relationship, and i want to make insertion of objectif i have manytomany between partenaire indicateur, manytomany between indicateur and annee and onetomany between annee objectif which mean that a partenaire can have many objectif, each of those objectif bellong to an annee and an annee bellong to indicateur here is my view on twig <ul class="spancabine"> <div> <label class="checkbox-inline"> {%

Symfony 2.8: isScopeActive deprecation after update to 2.8.0 from 2.7.7

左心房为你撑大大i 提交于 2019-12-12 08:09:15
问题 I've updated to symfony 2.8 from 2.7.7 and i get this deprecation: The Symfony\Component\DependencyInjection\Container::isScopeActive method is deprecated since version 2.8 and will be removed in 3.0. I use this call in a twig extension class: class TemplateHelper extends \Twig_Extension { private $request; private $container; /** * constructor * @param ContainerInterface $container */ public function __construct(ContainerInterface $container){ $this->container = $container; if( $this-

FOSOAuthServerBundle + FOSRestBundle + CamelCase = Not authenticating

佐手、 提交于 2019-12-12 05:19:04
问题 I have been working on my server in Symfony 2.8, building a rest api which returns json objects in camelCase style, the problem now is that when I integrate the OauthServer bundle it lauches this error Invalid grant_type parameter or parameter missing" , I understand that this happens because I am using the array_normalizer: fos_rest.normalizer.camel_keys body listener in my fos_rest configuration. Here my code in configuration.yml : fos_rest: #other listeners# body_listener: array_normalizer

Symfony Login Not working

孤者浪人 提交于 2019-12-12 04:49:50
问题 I'm using symfony 2.8, I'm new to symfony,I have implemented login and registration, registration is working fine but when I login it showing this error Type error: Argument 4 passed to Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken::__construct() must be of the type array, string given, called in C:\xampp\htdocs\blog\vendor\symfony\symfony\src\Symfony\Component\Security\Core\Authentication\Provider\UserAuthenticationProvider.php on line 96 Now I'm bit confused in

Case not work in doctrine query builder where clause

假装没事ソ 提交于 2019-12-12 04:48:21
问题 I am facing issue with mysql CASE in where clause of doctrine, $rides_q1 = $em->getRepository('IRRideBundle:Ride'); $query = $rides_q1->createQueryBuilder('a') ->where('(CASE WHEN a.ephemeral = 1 THEN a.date_beginning < NOW() AND a.date_ending > NOW()ELSE a.ephemeral = 0 END) AND a.active = 1 AND a.status = 5') ->getQuery(); $ridesQuery = $query->execute(); **[Syntax Error] line 0, col 93: Error: Expected Doctrine\ORM\Query\Lexer::T_ELSE, got '<'** [2/2] QueryException: [Syntax Error] line 0,

Translate labels in FormType

穿精又带淫゛_ 提交于 2019-12-12 03:37:48
问题 How can I translate labels values in Form builder. Example: ->add('google_analytics_key', TextType::class, [ 'label' => 'Analytics Key' ]) the "Analytics Key" is the value for the default locale. I am using the form with rows: {{ form_row(myForm.google_analytics_key) }} This renders the label with input type as well, so I cannot use the trans command. Is there something built in Symfony/Twig or I must implement the form manually? 回答1: You can add the domain of your translation and the key For