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

  • SEARCH
  • Home
  • 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 6806019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:39:32+00:00 2026-05-26T19:39:32+00:00

I’m developping an application with CakePHP and I’m experiencing some problems with my DB.

  • 0

I’m developping an application with CakePHP and I’m experiencing some problems with my DB.
The problem is that I have some tables with these kind of columns: sex (male/female), kind(image, video, text, song, link,…), …

There is many way to solve this problem:

  1. Creating linked tables listing sexes, kind of media, … but I already have many tables so I don’t want to overkill my DB.
  2. Chose the data type ENUM for the columns but CakePHP don’t like it.
  3. Use 1,2,3,… as an index for these columns and map an array in PHP for each columns (not a good idea in my opinion, where to instantiate these aray ?, hard to know the real value of an item in the db, …).
  4. Use the real, full textual value of the column for each items in the table but it’s redundant so loss of memory.

Personally, I think that the 4th possibility is the best but I would like to have other opinions or ideas to solve this problem.

Thanks in advance!

EDIT: I’m thinking of an other way to solve it.
If I make a table for each list, I’ll have many tables with just a few item and it’s a problem for the maintenance of the DB.
But if I make a table called for ex. “app_contants” which have an id, a name and a category (ex.: ‘1’, ‘female’, ‘user_sex’). All tables which need a list item, will refer on this table and if I want a specific list of this table, I just have to make “$this->AppContants->find(‘list’, array(‘conditions’ => array(‘category’, ‘user_sex’)));”

What do you think about this ?

  • 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-05-26T19:39:32+00:00Added an answer on May 26, 2026 at 7:39 pm

    there are many solutions out there:

    the array datasource for example

    But I prefer working with class constants and static methods representing the enums:
    http://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/

    A few months ago I even added Enum support in my baking templates.
    Makes them work out of the box – no one needs the database enums anyway.

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

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,

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.