I already read this "trick" in the cookbook: http://book.cakephp.org/2.0/en/models/model-attributes.html#usetable
Now I would like to create a custom schema for my model, but the format for this array does not exist. For example, I donβt know what should I use for the bool type: "boolean" or "bool"?
If I want to get a "select box" when I use $ this-> Form-> input, what type should I supply? Should I create a hasMany relation (with 2 non-standard models)?
the docs are here: http://book.cakephp.org/2.0/en/models/model-attributes.html#schema
here is an example contact form: http://www.dereuromark.de/2011/12/15/tools-plugin-part-2-contact-form/
As for booleans (tinyint 1):
protected $_schema = array( 'status' => array( 'type' => 'boolean', 'length' => 1, 'default' => 0, 'null' => false, 'comment' => 'some optional comment' ), );
TIPP: if you want to quickly find it yourself:
create the "Apples" table and the Apple model and add all the field types that you want to debug then call the model diagram () as follows:
debug($this->Apple->schema());
This is how I confirmed it.
And for the second part - I use the following ENUM solution for samples, if the values ββcan be considered "static": http://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/ otherwise you must use the relationships described in the cookbook or in the data source of the array.
Source: https://habr.com/ru/post/1437263/More articles:AWK - How to do selective sorting of multiple columns? - sortingHow can my program determine if it was launched via mpirun - mpi32-bit Powershell: use the ServerManager module? - scriptinghow to make cakephp 2.0 model without database table? - cakephp-2.0boost :: asio acceptor avoid memory leak - c ++Using memoization, but still the code works forever - cInstalling Python Tools for Visual Studio 2012 (PTVS) - pythonscanf not waiting for input in my loop? - cHow is a hot restart implemented in Meteor JS? - node.jsFilepicker.io - disable flash reserve - filepicker.ioAll Articles