Questions tagged with association

2 answers

0 votes

Asked by sebb86, on 5/1/10 in

How to create a relationship/association from one table/model to itself?

Hello,

how can i create a relationship from one model to itself?

In my case, i have a model "ports" with primary key "id" and foreign key "uplink_id".

Thanks if someone can help.

Greetings :)

0 answers

0 votes

Asked by sebb86, on 19/1/10 in

1 answer

0 votes

Asked by yesk13, on 7/1/10 in

possible to use find('list') across models?

are there any cakephp way of using find('list', array('fields' = array('User.id', 'Profile.nickname')))); ?

if i do that it'll throw an error.

for the time being i am using a function i wrote to get the list, not flexible function at that.

Your...

1 answer

0 votes

Asked by revenantprime, on 18/2/10 in

Form Initialization with Linked Models

Hi,

I have a complex database setup whereby a user creates a "Submission" that in turn has several "Wips" (Works in progress) for each stage of the piece. Each submitted Wip belongsTo one "Stage" (i.e. concept) that defines the progress of the...

2 answers

0 votes

Asked by revenantprime, on 18/2/10 in

Set additional fields in HABTM Join Table

Hi,

I'm working on a messaging system for a site that will allow users to send a message to multiple other users. I figured the easiest way to do this would be to create three tables:

Messages

Users

and Messages_Users with the...

1 answer

0 votes

Asked by revenantprime, on 28/2/10 in

Limiting/Specifying Associated Queries

Hello,

Basically I'm wondering if there's an easy way to do 2 things. I have a two tables, submissions and users joined by a HABTM relationship via submissions_users.

EDIT: Figured this part out

___________________________

Now say, for efficiency,...

0 answers

0 votes

Asked by danwalton, on 14/4/10 in

Strange (uncommon?) habtm/hasMany query

Ok, I have models:

RoleProfile,

Behaviour,

Indicator,

User

They are related as so:

User hasAndBelongsToMany RoleProfile

RoleProfile hasAndBelongsToMany Behaviour

Behaviour hasMany Indicator

Now, the bit I can't quite figure out;

Each indicator has a...

1 answer

0 votes

Asked by csj16, on 17/5/10 in

Associations?

I am very new to CakePHP and I would really appreciate any sort of help with this problem.

I have 3 tables in my database and 3 models for each of them:

User

Friend

Messages

Now I can't seem to figure out how to go about linking them with...

0 answers

0 votes

Asked by pinker42, on 8/6/10 in

Bug in MODEL->HABTM->HABTM->HasMany relationships ?

I have the following MODEL-HABTM-HABTM-HasMany relationship with 4 main tables and two join tables:

A (1 record) - (HABTM with table AB) B (13 records) - (HABTM with BC) C (131 records) - (hasMany) D (405 records)

When i fetch the data with...

1 answer

0 votes

Asked by saidbakr, on 16/6/10 in

Hierarchical categories - parent child -

Hi,

I made the following table which describes hierarchical relation of categories. The table name is categories


id:
name:
description:
category_id

I mean by this design to have self join for this table where the category_id field handles the id...

2 answers

0 votes

Asked by cchen, on 29/6/10 in

how to get table association records?

I have two models, User and Group. Each user can have multiple groups, and I defined the hasMany in the User model and belongsTo in the Group model. Now in the Groups controller I want to find the associated User record and get the fields to show...

1 answer

0 votes

Asked by marko, on 4/7/10 in

How can I use a date in a model association?

Hi,

I need advice on how to use the current date in the conditions of a model association.

The code below works, but when I try to change the date from "2007-07-07" to something dynamic, it stops working. I have tried these variations with no...

1 answer

0 votes

Asked by omidzaman, on 12/7/10 in

How to register a user and at the same time create a record in Account ( hasOne relation without form)

Hi

I am new to cake php and as a practice I am working on one simple

project.

I have tree model user, account and contact as below. (There is only

one form for user registration and no form for add action to account).

user model :

var $name =...

<< previous next >>