Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7759801
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:43:11+00:00 2026-06-01T13:43:11+00:00

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

  • 0

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 build a custom schema for my model, but there isn’t the format for this array. For example, I don’t know what should I put for a bool type: “boolean” or “bool”?

If I want to obtain a “select box” when I use $this->Form->input, what type should I put? Should I create a hasMany relationship (with 2 tableless models)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T13:43:12+00:00Added an answer on June 1, 2026 at 1:43 pm

    the docs are here: http://book.cakephp.org/2.0/en/models/model-attributes.html#schema

    here is an example for a 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 a quick way to find this out yourself:

    create a table “apples” and an Apple model and add all types of fields you want to debug
    then call the model schema() like so:

    debug($this->Apple->schema());
    

    this is how I confirmed the above.

    And for the second part – I use the following ENUM solution for select boxes if the values can be considered kind of “static”:
    http://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/
    otherwise you should use relations as documented in the cookbook or the array datasource.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've already read this question and this question and this , but none of
Possible Duplicate: What’s with the love of dynamic Languages I have already read this
I already read many article about this issue in here, SO. I just want
Scenario Having already read a post on this on the same site, which didn't
I've already read through the similar questions on this topic, but none of them
I read through many of solutions of this problem already, but I still can't
I have read some threads regarding this and I did already take steps to
those of you who read my previous questions may already know this: I'm currently
I have read this manual: http://git-scm.com/docs/gitignore As I am working with gitosis, I rather
I already read this question about socket synchronization but I still dont get it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.