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 518073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:53:59+00:00 2026-05-13T07:53:59+00:00

Hey I have coded CakePHP for a number of things but never ran into

  • 0

Hey I have coded CakePHP for a number of things but never ran into this problem before surprisingly. Also I have thoroughly searched the net and CakePHP docs and have not found an answer to my question. My question is, I have a table for my model that should be named Class, obviously I cannot use that name though since it’s a reserved PHP keyword. What options do I have to be able to refer to this model appropriately.

So far I have;

  1. Renamed my class model file to player_class.php
  2. Renamed my class model class to PlayerClass
  3. Changed var $name to ‘PlayerClass’
  4. Added to my class model class; var $useTable = ‘classes’;
  5. Renamed my class controller to player_classes_controller.php
  6. Renamed my class controller class to PlayerClassesController
  7. Changed var $name to ‘PlayerClasses’

While this does work, is this what has to be done or are to other options to be able to refer to it as Class still, like can I do any sort of mangling like _Class?

  • 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-13T07:53:59+00:00Added an answer on May 13, 2026 at 7:53 am

    When i run into this sort of problem i usually do what you did, only i prefix the reserved word with “My” (so when i read the code it doesn’t look like that class has anything to do with “Player”… for example, just the other day i wanted to model a “ACO” model.. but that already existed in cake (same scenario of reserved word) so i created a model called Myaco.

    I think you should just name it Myclass.

    Regarding the model name and controller name changes- i think you did good, i would do the same. Your only real option is to use the $useTable = 'classed'; to use your DB table.

    If you use the underscore prefix, i believe cake will not be able to handle it (it will fail in the Inflector class).

    Good luck

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

Sidebar

Ask A Question

Stats

  • Questions 319k
  • Answers 319k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer To answer your question, think about Single Responsibility Principle: "A… May 14, 2026 at 12:16 am
  • Editorial Team
    Editorial Team added an answer These are based on my personal experiences using the frameworks… May 14, 2026 at 12:16 am
  • Editorial Team
    Editorial Team added an answer An observable collection implements the famous "Observer" design pattern. It… May 14, 2026 at 12:16 am

Related Questions

Hey I have this code right here: http://pastie.org/534470 And on line 109 I get
hey, I have this code that should save a java.util.Vector of custom serializable classes:
Hey I have a windows server running python CGI scripts and I'm having a
hey I have been trying for hours and I don't understand why the following
Hey, I have a field called STATUS and it is either 1 to show

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.