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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:58:55+00:00 2026-05-16T09:58:55+00:00

My Self Joined Categories table is as follows: id, name, description, parent_id I used

  • 0

My Self Joined Categories table is as follows:

id, name, description, parent_id

I used Cake Bake to generate the Model, Controller and Views. Model
has the $belongsTo and $hasMany association set up. In add() of the
controller,

$parentCategories = $this->Category->ParentCategory->find('list');
$this->set(compact('parentCategories'));

is present. In the add view, the cake bake generated form is:

<?php
        echo $this->Form->input('name');
        echo $this->Form->input('description');
        echo $this->Form->input('isincome');
        echo $this->Form->input('parent_id');
?>

When I run in browser, the parent_id field is getting a drop down, but
it is not being filled with any data. I used

<?debug($parentCategories);?> 

in the add view, and it happily outputs

Array
(
    [1] => Entertainment
    [2] => Groceries
)

But this array is not being used for filling that drop down by the
Form helper. What should I do? Is this a bug with Cake’s Form helper in 1.3? It never occurred in 1.2…

  • 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-16T09:58:55+00:00Added an answer on May 16, 2026 at 9:58 am

    When adding an input for field_id, the form helper looks for a variable called $fields. I.e., the name without _id and pluralized. $parentCategories does not fit that description, so it’s not used. $parents would be.

    Second, $this->Category->ParentCategory is the same as $this->Category. Both reference the Category model. No need to go through ParentCategory.

    Third, it’s not usually a good idea to join a Tree model to itself. You’ll understand why when you start to query with higher recursive settings. You should instead make it a proper Tree and use the TreeBehavior methods to query it.

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

Sidebar

Related Questions

class Person(models.Model): name = models.CharField(max_length=128) def __unicode__(self): return self.name class Group(models.Model): name = models.CharField(max_length=128)
def self.jq_column_models COLUMN_NAME.collect {|x| {:name => x.to_s, :width => 80, :format => 'integer' if
I'm trying to create views that would accumulate all the needed data from joined
I'm trying to follow the code from the django docs: class Person(models.Model): name =
Say I have the good old person/group/membership relationship class Person(models.Model): name = models.CharField(max_length=128) def
I have projects and users joined via has_many :through join model called ownerships. Each
I created a joined table for the models category and products (both created with
self.scrollView.frame=CGRectMake(CGRectGetMinX(self.bounds),CGRectGetMaxY(self.bounds),CGRectGetWidth(self.bounds),CGRectGetHeight(self.bounds)); [self.scrollView addSubview:self.hourView]; [self.scrollView addSubview:self.gridView]; Now after embedding some views in the gridview, I
[[self enclosingScrollView] setHorizontalLineScroll:0]; the above api doesnt works. Help Appreciated...
[[self mainFrame] loadHTMLString:@<html><body><link href='main.css' rel='stylesheet' type='text/css' /></body></html> baseURL:nil]; I am trying to load a

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.