There is a site on yii1, with twig template engine, DB - PostgreSQL. The site previously worked successfully on the old server. After the transfer produces an error:

An exception has been thrown during the rendering of a template ("CDbCommand failed to execute the SQL statement: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "and" LINE 3: WHERE customer.visible AND customer.contest_id = and (selec... ^. The SQL statement executed was: SELECT customer.customer_id, count(vote.customer_id) as votes FROM pr_contest_customer customer LEFT JOIN pr_contest_vote vote ON (vote.customer_id = customer.customer_id) WHERE customer.visible AND customer.contest_id = and (select id from pr_customer_image image where customer.customer_id = image.customer_id limit 1) is not null GROUP BY "vote"."customer_id", "customer"."customer_id", "customer"."date_added" ORDER BY "votes" DESC LIMIT 6") in "/views/site/contest.twig" at line 60. 
  • It also says that there is an error in the request to the database, it cannot execute it due to a syntax error. Syntax error: 7 ERROR: syntax error at or near "and" - Nikita Davidenko Sept
  • @NickitaDavidenko, I see in this piece there is no value customer.contest_id = and. Debagger swears on protected / vendor / Twig / Template.php (148), so template engine is to blame - Roman Maltsev
  • It would be nice to look at the template code and the controller. - Nikita Davidenko September
  • @NickitaDavidenko the fact is that the error on all pages. Here is the line from the template where the error occurs: <ul class = "comp-members"> {% for rating in model ('ContestCustomer'). rating (contest ['id'], 6)%} {% include '@ widgets / site / contest_customer.twig '%} {% endfor%} </ ul> - Roman Maltsev
  • one
    @RomanMalcev template engine is not to blame, the functionality caused by template engine is to blame. Judging by the SQL, on a certain line of the template, a pending request (lazy load) is called to the model, which throws an exception. - etki

0