P
P
pistol2013-07-02 10:44:27
PHP
pistol, 2013-07-02 10:44:27

New field in cakePHP?

I added a field to the database, I saw that cakePHP has the concept of schemas and only the fields described in the schema are saved in the database when editing. Question - how now to add a new field and its description to the schema?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
P
pistol, 2013-07-03
@pistol

Yes, it turns out that the fields are cached. But deleting the cache does not help, a new cache file is immediately created, with the old fields. The solution was suggested on another forum, you need to write
Configure::write('debug', 2);
and call any page. The database fields will automatically be written into the schema and you can fully work with the field.

V
Vsevolod, 2013-07-02
@sevka_fedoroff

I don't think the schematics are the same. As far as I understand, they are needed to store the database structure in your project. Of course, I can be wrong, because. I didn't work with them myself.
But if you don't save the new field, try clearing the model cache, it's somewhere in the tmp folder. I faced this all the time. After adding a field to the database or changing the model, the application did not work properly due to the fact that the old models were cached.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question