My (mostly technical) blog

Posts Tagged ‘bugs

I have never been more in need of a proper PHP debugger in my whole life. I have been stuck with a very mysterious behavior with CakePHP for the past 4 hours.

I was editing a model, then saving it. For some reason, my form action was changing from

/controller/edit/1
to
/controller/add

it was making me go crazy!

After seaching around (finally) I found this: https://trac.cakephp.org/ticket/5871
I came to realize that I have actually omitted the

<?= form->input('id'); ?>

from my edit view because I thought “why the hell do I need to edit the primary key?”

As it turns out, CakePHP needs a field (hidden or not) with the name ID or else it will revert to the ADD form.

Luckily though, it is smart enough to render it as a hidden field.

Google is your friend.

Tags: ,

Ahmed Sabbour's Facebook profile
June 2017
S M T W T F S
« Jul    
 123
45678910
11121314151617
18192021222324
252627282930  

Tweets

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

RSS StackOverflow

Recently bookmarked