Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
ORM on save escape
  • I have been looking for the answer on the forum, but did not find it, so I ask. But I am almost sure, that it is not only my problem.

    I wrote a function in one of my ORM Model, which updates a number in a row. Unfortunately it updates all the fields, which contains non-ASCII characters, and escape them, so my name Sági-Kazár Márk will be Sági-Kazár Márk in the table.

    It was a problem for me earlier, but somehow it solved itself. :D But now I spent hours looking for the solution, but I did not find it.
  • HarroHarro
    Accepted Answer
    There is no code in the ORM that would touch data by itself, so the encoding most come from elsewhere.

    Also, the ORM will only update the fields that are changed, so the fact that all fields are updated must be related to something external that modifies the data.

    Are you passing the Model object to the view by any chance? That will encode the data, so after that, do not use that same model object to update the database!
  • Actually I use it in a Controller_Template. I tried to exit, and tried to return a new Response object, but did not work.
  • HarroHarro
    Accepted Answer
    Time to show us exactly what you're doing in your code, because without that it will remain guesswork.
  • I found the problem: you were right. I passed it to my email class, which passed it to a view, but in the model this could not be seen, so that was the problem. Thanks for your help.
  • Cool. Glad you got it sorted.

    For the next time, you can quicky check if this is the case by adding '\Orm\Model' to the security whitelist in your config.php. If that solves the problem, View encoding is the cause of the problem.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion