Master Filter for HABTM-Relationships

2009-09-14 Thread Marco
Hi guys, i'm using some HABTM-relationships between models, from whom one is an adaptation model. By switching the adaptation i want to set a kind of master filter for example in beforeFilter of app_controller.php. But i always receive a sql error because the adaptation code column isn't part

Filtering queries with hasMany relationships and pagination

2009-09-14 Thread tiberium911
Part of what I need to use CakePHP for is designing a report system for computer related data. There are filters on the web page that users can set to limit which computers are returned. Now my problem with CakePHP lies with the ability to prune results based on associations. A given computer has

Re: Filtering queries with hasMany relationships and pagination

2009-09-14 Thread Teh Treag
Maybe this article will assist you - http://teknoid.wordpress.com/2008/07/17/forcing-an-sql-join-in-cakephp/ On Sep 14, 8:52 am, tiberium911 tiberium...@gmail.com wrote: Part of what I need to use CakePHP for is designing a report system for computer related data. There are filters on the web

Saving Nested HABTM relationships

2009-09-03 Thread Andrew Senner
Alright, I searched the groups was wondering if I could get a little help with this. Here is the associations. Record HABTM Product Product HABTM Status I know the format for saving HABTM data is [Model][HABTM][HABTM] that is for Record to Product the format would be: $this-data {

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-31 Thread delocalizer
now I understand, you want associated user animal info for all specified Userpages... so as I suggested before, do the find on Userpage model... but use contain to provide the associated stuff: $pages = $this-Userpage-find('all',array( 'conditions'=array( 'or'=array(

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-31 Thread Sarah
Yay! The query works! :) Thank you! I really appreciate your patience. :) Thanks for your time and knowledge! ~Sarah On Aug 30, 11:07 pm, delocalizer conrad.leon...@hotmail.com wrote: now I understand, you want associated user animal info for all specified Userpages... so as I

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-30 Thread delocalizer
Ah I hadn't realised you just wanted Userpages - in which case why not call find on Userpage? If you're in Users controller: $pages = $this-User-Userpage-find('all',array( 'conditions'=array( 'or'=array( 'approved'=1, 'and'=array(

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-30 Thread Sarah
I'm performing this in the Userpages controller. I was calling find on Users because I need information on the user's animal. User hasMany Userpages User belongsTo Animal The foreign keys are set up appropriately. I need to get a list of all userpages in which: (Userpages.approved = 1) OR

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-30 Thread delocalizer
ok... but I'm still not sure exactly what your intent is. When you say you need information on THE user's animal - do you mean there is a particular user that you are trying to get information on, like the current requesting user? $id is a unique value in your method (ie. not a loop iterator or

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-30 Thread Sarah
I would like the results from the query to include all userpages that either have an approved value of 1 or belong to the current user (whose id is stored in the $id var) and have an approved value of -1. Basically I want a list of all userpages that are approved for public viewing or that are

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-29 Thread delocalizer
Hi Sarah, If you have a reasonably complicated find query with associated models and conditions, the core 'Containable' behaviour is very handy: http://book.cakephp.org/view/474/Containable so in your AppModel put this (and all your models will have access to the behaviour): var $actsAs =

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-29 Thread Sarah
Wow, this was very cool. Thank you for the advice. I realized I had forgotten a condition. So this is where I am now: $array = $this-User-find('all', array( 'fields'=array('id', 'animal_id'), 'order'=array('User.id'='asc'),

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-28 Thread Sarah
the Userpage.id field. On Aug 27, 3:19 pm, delocalizer conrad.leon...@hotmail.com wrote: Hi Sarah; If your relationships are set up correctly and you have recursive -1, the usual 'find' method on User model should be returning the parent 'Animal' anyway - what do you see if you put

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-28 Thread WebbedIT
Looks like you very nearly had it. Just got your find syntax slightly wrong, try: $array = $this-User-find('all', array( 'fields'=array('id, 'Userpage.id', 'User.animal_id', 'Animal.frontfilename'), 'conditions'=$conditions, 'order'=$order ); Then go have a look at the cookbook and study

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-28 Thread Sarah
I fixed my syntax, $conditions = array('or' = array( 'Userpage.approved' = 1, 'User.id' = $id) ); $order = array('User.id ASC', 'Userpage.id DESC'); $array = $this-User-find('all', array('fields'=array('id', 'Userpage.id', 'User.animal_id', 'Animal.frontfilename'), 'conditions'=$conditions,

Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-27 Thread Sarah
This is my setup: A 'user' hasMany 'userpage's. A 'user' belongsTo an 'animal'. I would like to be able to display user information as well as some information about the user's animal on a userpage view. I perform a find query to get the userpage id, user_id, animal_id. Is there a way to

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-27 Thread Sarah
Ah, that worked. :) Thank you! On Aug 27, 3:19 pm, delocalizer conrad.leon...@hotmail.com wrote: Hi Sarah; If your relationships are set up correctly and you have recursive -1, the usual 'find' method on User model should be returning the parent 'Animal' anyway - what do you see if you

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-27 Thread Sarah
27, 3:19 pm, delocalizer conrad.leon...@hotmail.com wrote: Hi Sarah; If your relationships are set up correctly and you have recursive -1, the usual 'find' method on User model should be returning the parent 'Animal' anyway - what do you see if you put this in one of your user controller

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-27 Thread delocalizer
Hi Sarah; If your relationships are set up correctly and you have recursive -1, the usual 'find' method on User model should be returning the parent 'Animal' anyway - what do you see if you put this in one of your user controller functions: $example = $this-User-find('first'); debug($example

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-27 Thread Sarah
Sarah; If your relationships are set up correctly and you have recursive -1, the usual 'find' method on User model should be returning the parent 'Animal' anyway - what do you see if you put this in one of your user controller functions: $example = $this-User-find('first'); debug($example

Re: Using belongsTo and hasMany relationships: Is it possible to access tables through a chain of relationships?

2009-08-27 Thread delocalizer
wrote: Hi Sarah; If your relationships are set up correctly and you have recursive -1, the usual 'find' method on User model should be returning the parent 'Animal' anyway - what do you see if you put this in one of your user controller functions: $example = $this-User-find('first

Re: Scaffolding and Model Relationships

2009-08-22 Thread gerhardsletten
Hi Jeff Have experienced the same too. Also I have found that the templates I get after I have baked the views differ from what I have when only using the shaffold function. Gerhard --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Scaffolding and Model Relationships

2009-08-21 Thread JDRopp
name role_id I've defined the relationships appropriately: 1) applications has many application roles 2) applications_roles belongs to applications 3) applications_roles belongs to roles 4) roles has many application roles When viewing an application, a Related

Model Relationships

2009-08-16 Thread Josh
Hi, I am setting up the tables/models for a new app and I've hit a sticking point. I am setting up three tables right now: datatypes: This table provides a list of the names incoming data types. datatypes_validations: This table links the two, allowing data types to have multiple validation

Re: Model Relationships

2009-08-16 Thread Josh
I was just reading the documentation on model associations... I need HABTM associations to use a join table... On Aug 16, 6:48 pm, Josh joshs.silver...@gmail.com wrote: Hi, I am setting up the tables/models for a new app and I've hit a sticking point. I am setting up three tables right

Re: Model Relationships

2009-08-16 Thread Josh
Hmm... it turns out that the errors I was getting were actually be generated by my use of Validation as a model name for the validation rules. That class is already taken. I still changed over to HABTM relationships for better functionality. On Aug 16, 9:58 pm, Josh joshs.silver...@gmail.com

Re: Problem with hasMany/belongsTo relationships - not returning related records.

2009-07-25 Thread Alastair
On Jul 24, 10:10 pm, mariusz.lewandowski lew...@gmail.com wrote: I'm also looking for some convinient way to avoid invoking bindModel method .. I'll tell you what fixed my problem, it was giving the model file the correct extension. My comment model file was named comment.ctp not comment.php

Re: Problem with hasMany/belongsTo relationships - not returning related records.

2009-07-24 Thread mariusz.lewandowski
I'm also looking for some convinient way to avoid invoking bindModel method .. On Jul 23, 1:52 pm, Alastair alast...@zanginteractive.com wrote: Hi and many thanks for your help! This did work, however it doesn't make sense that I've had to do this in the first place! It seems like accessing

Re: Problem with hasMany/belongsTo relationships - not returning related records.

2009-07-23 Thread mariusz.lewandowski
I had the same issue. The resolutions goes like that: in beforeFilter i invoke: public function beforeFilter() { $this-pageTitle = 'Portfolio'; $this-Portfolio-bindModel(array( 'belongsTo' =

Re: Problem with hasMany/belongsTo relationships - not returning related records.

2009-07-23 Thread Alastair
Hi and many thanks for your help! This did work, however it doesn't make sense that I've had to do this in the first place! It seems like accessing the parent model of a child model is broken. I don't know if I'm doing something completely wrong but I can access my comments records from the user

Problem with hasMany/belongsTo relationships - not returning related records.

2009-07-22 Thread Alastair
Hoping someone can suggest something here! I have a number of models, which look as follows: Comment -- class Comment extends AppModel { var $name = 'Comment'; var $validate = array( 'body' = array('rule' = 'notEmpty') ); var

Setting up relationships

2009-07-12 Thread Matthew
Hello all, I am new to cakephp and I am having trouble setting up the following relationships for my photo blog. Here are the relationships Post: hasMany: array('Photo') Photo: belongsTo: array('Post', 'Equipment') Equipment: hasMany: array('Photo') Essentially a post can have many pictures

Re: Setting up relationships

2009-07-12 Thread Miles J
Can we see your query you are using? And are you using recursive or containable. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To

Re: Setting up relationships

2009-07-12 Thread Matthew
To be honest I am not sure the difference between recursive and containable. I am using a simple: $this-Post-findAll() to get the data. Does that help? On Jul 12, 5:13 pm, Miles J mileswjohn...@gmail.com wrote: Can we see your query you are using? And are you using recursive or containable.

Re: Setting up relationships

2009-07-12 Thread Miles J
I suggest you dont use $recursive and use Containable behavior instead. http://book.cakephp.org/view/474/Containable Your query could then become: $this-Post-find('all', array('contain' = array('Photo' = array ('Equipment'; --~--~-~--~~~---~--~~ You received

Re: Setting up relationships

2009-07-12 Thread Matthew
Got it! Thanks a lot for your prompt responses and help today, Miles. -Matt On Jul 12, 7:56 pm, Miles J mileswjohn...@gmail.com wrote: I suggest you dont use $recursive and use Containable behavior instead.http://book.cakephp.org/view/474/Containable Your query could then become:

Re: How to prevent circular relationships ?

2009-07-09 Thread Brendon Kozlowski (Realm)
syntax is singulartablename_id.  Do you know if there's a way to change that Workbench default? Jon Chin Mike Bates wrote: Is there a reason for Machine and Service to have many to many relationships (machine with Type and category, Service with customer)? There are often

How to prevent circular relationships ?

2009-07-08 Thread iFeghali
on a complex web. I could also made relationships one way only, but obviously it would break the views for the other models. so my question is whether i can set recursive to 2, but tells cake not to retrieve the main model thus preventing circular data. Thank you

Re: How to prevent circular relationships ?

2009-07-08 Thread brian
models in the view action, but that would be too much extra code for something apparently simple. note that the given scenario is just an exemplification, my real case has around 8 models tied on a complex web. I could also made relationships one way only, but obviously it would break the views

Re: How to prevent circular relationships ?

2009-07-08 Thread Mike Bates
Is there a reason for Machine and Service to have many to many relationships (machine with Type and category, Service with customer)? There are often complications when you have db design with many to many relationships. Try creating new tables in between them so you can have HABTM between machine

Re: How to prevent circular relationships ?

2009-07-08 Thread iFeghali
Without Containable, you'd end up needing to use the unbindModel() method of the model, multiple times if you're paring off multiple models. Containable creates a cleaner way to accomplish this same task. seems a good alternative for me :) thank you On Jul 8, 1:35 pm, brian

Re: How to prevent circular relationships ?

2009-07-08 Thread iFeghali
On Jul 8, 1:35 pm, Mike Bates mba...@opskwan.com wrote: Is there a reason for Machine and Service to have many to many relationships (machine with Type and category, Service with customer)? There are often perhaps I misunderstand you but those relationships are defined as one to many. e.g

Re: How to prevent circular relationships ?

2009-07-08 Thread Mike Bates
My fault, I wasn't reading your description correctly. On Wed, Jul 8, 2009 at 9:53 AM, iFeghali igor.fegh...@gmail.com wrote: On Jul 8, 1:35 pm, Mike Bates mba...@opskwan.com wrote: Is there a reason for Machine and Service to have many to many relationships (machine with Type

Re: How to prevent circular relationships ?

2009-07-08 Thread Jon Chin
? Jon Chin Mike Bates wrote: Is there a reason for Machine and Service to have many to many relationships (machine with Type and category, Service with customer)? There are often complications when you have db design with many to many relationships. Try creating new tables in between them

Re: How to prevent circular relationships ?

2009-07-08 Thread Mike Bates
. Do you know if there's a way to change that Workbench default? Jon Chin Mike Bates wrote: Is there a reason for Machine and Service to have many to many relationships (machine with Type and category, Service with customer)? There are often complications when you have db design

Re: Question about relationships

2009-07-07 Thread Robert P
Official documentation to the rescue: http://book.cakephp.org/ contains the answers to *most* of the questions you will have regarding Cake. For this specific question try http://book.cakephp.org/view/84/Saving-Related-Model-Data-hasOne-hasMany-belongsTo

Question about relationships

2009-07-06 Thread Alastair
Hi guys, Hopefully a fairly straight forward question. I have the following two models: Member, User. User hasOne Member, Member belongsTo User. In my application, I have a Members admin area, which lists all the Members. I need to allow the admin to create a corresponding User for a Member and

Problems with $uses and model relationships

2009-06-23 Thread DavidH
in the following relationship: Dashboard has many Kpi and a Kpi belongs to many dashboards A Kpi has many Ranges and a Range belongs to a Kpi A Range has one Colour and a Colour has many Ranges I'm pretty confident that all the relationships are set correctly in the models as I had a set of basic controllers

Re: Problems with $uses and model relationships

2009-06-23 Thread Simz
has many Ranges I'm pretty confident that all the relationships are set correctly in the models as I had a set of basic controllers / views working OK before. Now I've created a new 'showdashboard' method in my Dashboards controller along with a showdashboard.ctp view. The purpose

Re: Problems with $uses and model relationships

2009-06-23 Thread DavidH
the relationships are set correctly in the models as I had a set of basic controllers / views working OK before. Now I've created a new 'showdashboard' method in my Dashboards controller along with a showdashboard.ctp view. The purpose of this is to display all the KPIs on a dashboard coloured

Re: Problem with retrieving data with relationships

2009-05-25 Thread Bryan Paddock
ahhh awesome thanks man... still getting to grips with cakephp here! On Sat, May 23, 2009 at 8:45 PM, Ricky Paz ricky...@gmail.com wrote: Hi, You have to use belongsTo and hasMany for 1-n relationship, and not hasOne and hasMany. In your PropertiesModel, put $belongsTo = 'Seller, and,

Re: Problem with retrieving data with relationships

2009-05-23 Thread number9
I'm fairly new myself so you will have to bear with me here! How do you reference fields in your view? There may be a problem there if that is wrong. Have you baked the controllers/views? I think the problem is probably your recursive setting, try adding this line to your controller:

Re: Problem with retrieving data with relationships

2009-05-23 Thread Ricky Paz
Hi, You have to use belongsTo and hasMany for 1-n relationship, and not hasOne and hasMany. In your PropertiesModel, put $belongsTo = 'Seller, and, inside SellerModel, put hasMany = 'Property'. --~--~-~--~~~---~--~~ You received this message because you are

Problem with retrieving data with relationships

2009-05-22 Thread Bryan Paddock
Hi all, Just started learning cakephp last week so a bit scratchy and still learning... There are two tables in question here: property - stores rows of properties seller - stores sellers of the properties. - one property can only have one seller - one seller can have many properties

Extending model/changing relationships

2009-05-20 Thread toby1kenobi
Hi there, I am using the excellent ExtendableBehaviour (http://tinyurl.com/ extendablebehaviour) in my implementation of single-table inheritance. In my sub-classes of my base model I have tried to re-declare $hasMany, which is different for my various child classes. However, the $hasMany

Re: Extending model/changing relationships

2009-05-20 Thread toby1kenobi
PS In simpler terms my question is, if one Model inherits from another, should I be able to override $hasMany in the child class? On May 20, 2:58 pm, toby1kenobi toby.math...@gmail.com wrote: Hi there,   I am using the excellent ExtendableBehaviour (http://tinyurl.com/ extendablebehaviour)

a question on model relationships

2009-05-14 Thread Beedge
Hey all, I have (or plan to have!) an app that will allow users to view products by category. Each category can have a sub category and each sub category can have further sub categories.. eg. sportstennisracketswooden There is no limit to the dept of sub categories.. (like in Ebay) I plan to

Re: a question on model relationships

2009-05-14 Thread PaulMan
Try Tree Behavior for category-SubCategory-SubCategory , and workit all in the same model Category ... Product Model public $hasAndBelongsToMany = array('Category'); Category Model public $hasAndBelongsToMany = array('Product'); public $hasMany = array('SubCategory'=

Re: a question on model relationships

2009-05-14 Thread Beedge
Thats great thanks, looking at the cook book section on tree's and although I dont quite get it at first glance, it looks like its exactly what I need Thanks again, Kevin On May 14, 10:49 am, PaulMan pho...@gmail.com wrote: Try Tree Behavior for category-SubCategory-SubCategory , and workit

Re: a question on model relationships

2009-05-14 Thread Beedge
Now that I think about it, would a tree structure mean that each sub category can only appear in one tree? e.g a furniture shop might have Living room tables and Dining Room tables so can the sub category tables appear in both trees? --~--~-~--~~~---~--~~

Re: a question on model relationships

2009-05-14 Thread PaulMan
No, I Tree has unique branches.. A Table for Dining Room , is not a table for a Living Room but i think if you reverse the order you will get more organized put Tables( id:5 ) - Living Room ( id:6 ) Tables( id:5 ) - Dinning Room ( id:7 ) * ids are only examples and on the

Re: a question on model relationships

2009-05-14 Thread brian
On Thu, May 14, 2009 at 6:50 AM, PaulMan pho...@gmail.com wrote: No, I Tree has unique branches.. A Table for Dining Room , is not a table for a Living Room but i think if you reverse the order you will get more organized put Tables( id:5 ) - Living Room ( id:6 ) Tables( id:5 ) -

Re: a question on model relationships

2009-05-14 Thread PaulMan
You should analize you problem realy good, I has a similar problem, on a Food Chain Distribution B2b Site and it worked 5 Stars for me. Good Luck... On May 14, 4:28 pm, brian bally.z...@gmail.com wrote: On Thu, May 14, 2009 at 6:50 AM, PaulMan pho...@gmail.com wrote: No, I Tree has

Re: Saving multiple models/relationships with saveAll()

2009-04-29 Thread Martin Westin
Trac is the place to add an RFC or enhancement ticket for a future version. Since 1.2 is still young you might wait a good while but on the other hand now is the time new features are evaluated... not during beta. https://trac.cakephp.org/ On Apr 28, 9:42 pm, rartavia royarta...@gmail.com

Re: Saving multiple models/relationships with saveAll()

2009-04-29 Thread rartavia
Hi there, thanks for you answer. I placed the ticket, will see what happens. https://trac.cakephp.org/ticket/6331 Regards --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send

Re: Saving multiple models/relationships with saveAll()

2009-04-28 Thread Martin Westin
I don't use saveAll much myself but oen thing you can look into is the phrasing that explains what it does. I remember reading that saveAll can save multiple records of a single model OR one record and multiple related Models. I am not sure it ca do both at the same time the way you are trying.

Re: Saving multiple models/relationships with saveAll()

2009-04-28 Thread rartavia
Hello, thanks Martin. I reviewed saveAll() docs and it explicitly tells it wont work for not directly associated models. (http://book.cakephp.org/view/75/Saving-Your-Data) It would be nice for a future version of cake to have it though. Where does one submits this kind of petitions to cake

Re: Saving multiple models/relationships with saveAll()

2009-04-28 Thread rartavia
This is how I worked out saving not directly related data using saveAll in one single Ajax call: I send the data exactly the same, as in this discussion's first message, with the non directly related model INSIDE the directly related model (SectionParts INSIDE data[Section])

Saving multiple models/relationships with saveAll()

2009-04-27 Thread rartavia
I'm saving to one main table with several kind of relations by sending all in a single array via Ajax (jQuery). One is a nested relation, denouncements (main table) hasMany sections (other-model) which hasMany section_parts (another-model). Sending to saveAll in a single array i'm being able to

Multiple hasMany relationships to one model?

2009-03-31 Thread Adam M
Hi All, How can I PROPERLY set up my database so that several models have multiple images? Each image belongs to a particular model, so they are definitely hasMany relationships. Example: Episode -id -name -date Movie -id -name -date -producer Image -id -name -caption -path Episode hasMany

Re: Multiple hasMany relationships to one model?

2009-03-31 Thread Amit
model, so they are definitely hasMany relationships.  Example: Episode -id -name -date Movie -id -name -date -producer Image -id -name -caption -path Episode hasMany Image Movie hasMany Image Does the paradigm of adding a foreign key to the Image table still apply if I have

Re: Multiple hasMany relationships to one model?

2009-03-31 Thread brian
they are definitely hasMany relationships.  Example: Episode -id -name -date Movie -id -name -date -producer Image -id -name -caption -path Episode hasMany Image Movie hasMany Image Does the paradigm of adding a foreign key to the Image table still apply if I have multiple

Re: Multiple hasMany relationships to one model?

2009-03-31 Thread Amit
have multiple images?  Each image belongs to a particular model, so they are definitely hasMany relationships.  Example: Episode -id -name -date Movie -id -name -date -producer Image -id -name -caption -path Episode hasMany Image Movie hasMany Image Does

HABTM Relationships Problem

2009-03-18 Thread Pete Bekisz
Hi all, I'm having some problems with saving HABTM relationships, and I was hoping you could help me. The two models in question are Registrant and Product. In my Registrant model, I have a method that builds an array that looks like this: Array ( [Registrant] = Array

Re: HABTM Relationships Problem

2009-03-18 Thread nhathoang nhathoang
I hope you can post your database , I think you are not wrong in configuring , but It difficult to answer you if you don't post database and say more about your achivement 2009/3/19 Pete Bekisz pbek...@keuka.edu Hi all, I'm having some problems with saving HABTM relationships, and I

Help on somewhat complicated model relationships

2009-03-12 Thread George
I have an application that is using three user models, from three datasources. One is specifically built for the application (User), one is LDAP-based (NetworkAccount), and the third is a static database (Salesperson), in that I can only read from it. I'm also using the ACL component, which

Advanced relationships (roles on an element basis)

2009-03-10 Thread jakobjp
I'm trying to figure out how to create a system that can handle the following: Models: user, post, category Roles: regular, moderator, admin - User (regular user) can create posts in categories. - User (regular user) can edit own posts. - Multiple users can have the role moderator in multiple

Model Relationships

2009-03-08 Thread Dave Maharaj :: WidePixels.com
I am stumped on setting up model relationship for my site. I am building an education site with 4 user groups. The 2 in question are STUDENTS and TEACHERS. How I have set it up there are 2 registration forms to create the USER (TEACHERS or STUDENTS) so on sign up it creates the USER and

Re: Model Relationships

2009-03-08 Thread brian
Create a Bookmark model and associate it with User: id created modified user_id post_id title link On Sun, Mar 8, 2009 at 1:58 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I am stumped on setting up model relationship for my site. I am building an education site with 4 user

RE: Model Relationships

2009-03-08 Thread Dave Maharaj :: WidePixels.com
Relationships Create a Bookmark model and associate it with User: id created modified user_id post_id title link On Sun, Mar 8, 2009 at 1:58 PM, Dave Maharaj :: WidePixels.com d...@widepixels.com wrote: I am stumped on setting up model relationship for my site. I am building an education site with 4

Re: containable on deep model relationships

2009-02-16 Thread WebbedIT
I asked many questions on here before eventually realising Cake will not automatically join a deep ( User - Event - EventType) belongsTo association so recursive would not help, but I'm certain contain should catch it?!? The other option is to force a join from User to EventType by unbinding the

Re: containable on deep model relationships

2009-02-16 Thread mscdex
On Feb 16, 4:59 am, WebbedIT p...@webbedit.co.uk wrote: I asked many questions on here before eventually realising Cake will not automatically join a deep ( User - Event - EventType) belongsTo association so recursive would not help http://book.cakephp.org/view/439/recursive

Re: containable on deep model relationships

2009-02-16 Thread WebbedIT
mscdex: Is that post supposed to explain something to me? If so, then I'm afraid you will have to be a bit more descriptive. I happily bow to those who know more than me (and I concede that is most of the active members of the group, including yourself after answering a unique id issue for me

Re: containable on deep model relationships

2009-02-16 Thread mscdex
On Feb 16, 12:29 pm, WebbedIT p...@webbedit.co.uk wrote: I happily bow to those who know more than me (and I concede that is most of the active members of the group, including yourself after answering a unique id issue for me last week) but the book's example for recursive does not contain a

Re: containable on deep model relationships

2009-02-16 Thread brian
Maybe this is related to what you're discussing (includes solution): http://groups.google.com/group/cake-php/browse_thread/thread/9b4f86efc70348e1/67c4776d14362750?show_docid=67c4776d14362750pli=1 On Mon, Feb 16, 2009 at 2:42 PM, mscdex msc...@gmail.com wrote: On Feb 16, 12:29 pm, WebbedIT

Can you have multiple hasAndBelongsToMany relationships in one model?

2009-02-16 Thread mklappen
Hi, I'm new to cake and this group, I would like to know if it is possible to add multiple hasAndBelongsToMany relationships in one model? ( I assume it is...) my declaration first instance of it is working fine, however it's not letting me add another... example: ?php class Game extends

Re: Can you have multiple hasAndBelongsToMany relationships in one model?

2009-02-16 Thread Adam Royle
var $hasAndBelongsToMany = array('Developer','Publisher'); - Original Message - From: mklappen mklap...@gmail.com To: CakePHP cake-php@googlegroups.com Sent: Tuesday, February 17, 2009 9:24 AM Subject: Can you have multiple hasAndBelongsToMany relationships in one model? Hi, I'm

Re: Can you have multiple hasAndBelongsToMany relationships in one model?

2009-02-16 Thread mklappen
: mklappen mklap...@gmail.com To: CakePHP cake-php@googlegroups.com Sent: Tuesday, February 17, 2009 9:24 AM Subject: Can you have multiple hasAndBelongsToMany relationships in one model? Hi, I'm new to cake and this group, I would like to know if it is possible to add multiple

Re: containable on deep model relationships

2009-02-15 Thread mike
oops, that was I typo, I have that already, with the end paren. I've also tried what Miles suggested, same thing any other ideas? On Feb 14, 5:25 am, WebbedIT p...@webbedit.co.uk wrote: I surprised that find call fetches any data as you have your contain criteria mixed in with your

Re: containable on deep model relationships

2009-02-15 Thread mscdex
On Feb 15, 12:00 pm, mike mwu...@gmail.com wrote: any other ideas? Did you try specifying a high enough 'recursive' level? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send

Re: containable on deep model relationships

2009-02-14 Thread WebbedIT
I surprised that find call fetches any data as you have your contain criteria mixed in with your conditions array. It should be something like: $this-User-find('all', array( 'conditions' = array('User.id' = $user_id), 'contain' = array( 'Event' = array( 'Eventtype' = array(

containable on deep model relationships

2009-02-13 Thread mike
I got user has many event, event belongsTo eventtype and user, eventtype has many event make sense? did I set this up right? I trying to fetch all the data for one event. Following the example in the cookbook, I tried this: $this-User-find('all', array( 'conditions' =

Re: containable on deep model relationships

2009-02-13 Thread Miles J
Try this: 'contain' = array('Event' = array( 'Eventtype.id', 'Eventtype.eventName')) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To

Model Relationships Help

2009-01-26 Thread cds
I'm building an internal project management system with companies, projects, tasks, reference items, file attachments, comments (for collaboration w/ client), and some other things. Attachments, Reference Items, Comments should be able to map to a general project as a whole, a specific task, or

Re: Relationships - HABTM

2009-01-21 Thread Webweave
http://book.cakephp.org/view/439/recursive On Jan 19, 7:57 am, rhythmicde...@gmail.com rhythmicde...@gmail.com wrote: I have been making some pretty good headway on defining the relationships for my models. However I am not getting some data that I expect to get. This may be due to my

RE: Relationships - HABTM

2009-01-21 Thread Steven Wright
Thank you. -Original Message- From: cake-php@googlegroups.com [mailto:cake-...@googlegroups.com] On Behalf Of Webweave Sent: Wednesday, January 21, 2009 4:33 PM To: CakePHP Subject: Re: Relationships - HABTM http://book.cakephp.org/view/439/recursive On Jan 19, 7:57 am, rhythmicde

Relationships - HABTM

2009-01-19 Thread rhythmicde...@gmail.com
I have been making some pretty good headway on defining the relationships for my models. However I am not getting some data that I expect to get. This may be due to my relationship definitions or a misunderstanding of what CakePHP will do for me. I am hoping one you can point me in the right

Re: Relationships - HABTM

2009-01-19 Thread brian
On Mon, Jan 19, 2009 at 10:57 AM, rhythmicde...@gmail.com rhythmicde...@gmail.com wrote: I have been making some pretty good headway on defining the relationships for my models. However I am not getting some data that I expect to get. This may be due to my relationship definitions

RE: Relationships - HABTM

2009-01-19 Thread Steven Wright
: Relationships - HABTM On Mon, Jan 19, 2009 at 10:57 AM, rhythmicde...@gmail.com rhythmicde...@gmail.com wrote: I have been making some pretty good headway on defining the relationships for my models. However I am not getting some data that I expect to get. This may be due to my relationship

Re: Relationships - HABTM

2009-01-19 Thread brian
: Relationships - HABTM On Mon, Jan 19, 2009 at 10:57 AM, rhythmicde...@gmail.com rhythmicde...@gmail.com wrote: I have been making some pretty good headway on defining the relationships for my models. However I am not getting some data that I expect to get. This may be due to my relationship

<    1   2   3   4   >