I’m new to Cake and maybe this is just a dumb question.
Inside a component I’m creating an entity, updating its values and getting it back again from the db (it’s just a test that I’m performing to understand the framework).
Here’s the code:
$contact_form = $this->contact_forms->get(1); $this->assertTrue(! empty($contact_form)); $this->assertEquals('Contacts', $contact_form->get('header_text')); $contact_form->set('header_text', 'New header text'); $this->contact_forms->save($contact_form); $contact_form = $this->contact_forms->get(1); $this->assertEquals('New header text', $contact_form->get('header_text'));
The problem is that, the last test fails because ‘header_text’ is still ‘Contacts’. The db is updated correctly: I can see the new values in the correct place. The $contact_form contains a original field with the correct data $original[‘header_text’] => ‘New header text’.
I’m not caching anything (unless Cake is doing it by default). What am I doing wrong ?