Retrieving information with a hasMany through (The Join Model) association.

2012-07-02 Thread Ronen Amiel
Hey everyone, I'm I have a hasMany through (The Join Model) association on my application. I have 3 models in my application: students, courses and the join model: membership (used as a join model and also tracks grades). I'm trying to retrieve some information from the database, I want to get

Re: Filter on a deep model association

2012-03-01 Thread lowpass
But the 2nd version would be pretty ugly because the Collection array would be repeated for each Author. I think the first is the way to go because what you're really doing is viewing a Collection. The Books and Authors are secondary. To sort the Authors, I think you might be able to use the Set

Filter on a deep model association

2012-02-28 Thread whatsnew
Hi, I have these 3 associated models : class Author extends AppModel { var $hasAndBelongsToMany = array('Book'); } class Book extends AppModel { var $belongsTo = array('Collection'); var $hasAndBelongsToMany = array('Author'); } class Collection extends AppModel {

Re: Filter on a deep model association

2012-02-28 Thread lowpass
What do you mean by filtered? Do you want to sort by Collection, or do you want to select only specific Collections? And which controller/model do you want to do this from? Because the models are associated, code from, eg. the Book model can run a find() from the Collection model.

Re: Filter on a deep model association

2012-02-28 Thread whatsnew
By filter I mean to select all authors where Collection is equal to a collection_id and do it from the authors controller. I can't simply do a $this-Author- find('all',array('conditions'=array('Collection.id'= $collection_id)) because the Author model is not associated with the Collection model.

Re: Filter on a deep model association

2012-02-28 Thread lowpass
Go 3 levels deep so the data is arranged by the particular Collection you're after. $data = $this-Author-Book-Collection-find( 'first', array( 'conditions' = array( 'Collection.id' = $c_id ), 'contain' =

Re: Filter on a deep model association

2012-02-28 Thread whatsnew
Your second proposition is close to what I need, but my Grail would be to have the list of the authors (sorted alphabetically) each with its associated books published in a given collection. I guess that with some tweaking of the array of results I can get there but it's not very elegant. Thanks

Re: Custom model association column

2012-02-25 Thread djogo
Hello all, Your suggestions would work, however I`m trying to get a shortcut here = eliminating the Subject. is there any way that we could specify a join condition, like 'hasMany' = array( 'model' = 'Contents', 'join' = 'Contents.subject_id = HospitalAdmission.subject_id' ... ) ?

Re: Custom model association column

2012-02-25 Thread jeremyharris
Cake will automatically build that condition based off of the current model's primary key and the foreignKey you specify in the $hasMany relationship. You can supply additional conditions using the 'conditions' key on that relationship. $hasMany = array( 'Content' = array( 'foreignKey' =

Re: Custom model association column

2012-02-22 Thread Stephen Speakman
Something i need to bear in mind when mapping my models, no joining between two connections. Could you not find a behaviour to create a temporary table as a very last resort? Sent from my iPhone On 21 Feb 2012, at 21:37, jeremyharris funeralm...@gmail.com wrote: Does Containable not

Custom model association column

2012-02-21 Thread Diogo FC Patrao
Hi all I have a data model like this: *HospitalAdmission* belongsTo *Subject* hasMany *Contents* That is, I have a subject_id column on HospitalAdmission, and a column with the same name in Contents. Plus, HospitalAdmission is in one database, and Subject and Contents in other, not being

Re: Custom model association column

2012-02-21 Thread jeremyharris
Does Containable not work? $this-HospitalAdmission-find('all', array( 'contain' = array( 'Subject' = array( 'Contents' ) ) )); -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org

Re: Model Association and Find

2012-01-09 Thread jeremyharris
Since HABTM data is constructed as separate SQL statements, and not a JOIN, you cannot add conditions to the query directly. There are ways to get the data you want, though. Check out the example in the book[1] or search Google for cakephp find habtm data 1:

Model Association and Find

2012-01-08 Thread Fernando Nery Filho
Hello all! I've been programming in PHP for a while now but just started to use Cake in this new project I'm working. I have 3 Table I'd like to Associate together: Movies, Actors and Cast My Movie Model is set the following way: *public $hasAndBelongsToMany = array(* *'Elenco' = array(*

cake model association error

2011-06-22 Thread madusanka hettiarachchi
HI guys, Im new to cake! I made a association between two models called Album and Subalbum. association should be like this, Subalbum hasOne Album Album hasMany Subalbums bt I got error like this, * 1054: Unknown column 'Album.subalbum_id' in 'on clause'

Re: cake model association error

2011-06-22 Thread Jeremy Burns | Class Outfit
Try this instead: :Subalbum model::: var $belongsTo = array('Album'); Jeremy Burns Class Outfit jeremybu...@classoutfit.com http://www.classoutfit.com On 22 Jun 2011, at 08:54, madusanka hettiarachchi wrote: HI guys, Im new to cake! I made a association between two models

Re: cake model association error

2011-06-22 Thread madusanka hettiarachchi
Hi Jeramy, thank you very much, As u said error was there. thanks you again for saving my time! -- Forwarded message -- From: Jeremy Burns | Class Outfit jeremybu...@classoutfit.com Date: Wed, Jun 22, 2011 at 1:38 PM Subject: Re: cake model association error To: cake-php

Adding a count to model association

2011-02-17 Thread Rene_
Hi, does anyone know how to add a custom count to a model? I've tryied using 'finderQuery', and 'counterQuery', and no results.. My count query, and model looks like this: var $hasMany = array( 'Record' = array('className' = 'Record', 'foreignKey' = 'id',

How would one set up this model association?

2011-01-26 Thread Chillwabbitt
Hi I have three tables all linked to one lookup table like so: +- + | AUXProductOption | + +--- + |

Re: How would one set up this model association?

2011-01-26 Thread Chillwabbitt
OK forget that here's a picture http://i29.photobucket.com/albums/c297/Chillwabbitt/junk/Screenshot.png -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP

Re: URGENT - Help needed - Model Association

2010-12-31 Thread Karthikeyan P
as *comments * only I guess the problem is in the relationship type during the model association ? Not sure though Thanks Karthikeyan P On Thu, Dec 30, 2010 at 4:08 AM, john lyles confidentia...@gmail.comwrote: If the model names are Post and User then the table names should be 'posts

Re: URGENT - Help needed - Model Association

2010-12-30 Thread cricket
' table, not a 'Comments' table. I have not defined anywhere as Comments Table..I have done as comments only I guess the problem is in the relationship type during the model association ? Not sure though Thanks Karthikeyan P On Thu, Dec 30, 2010 at 4:08 AM, john lyles confidentia...@gmail.com

Re: URGENT - Help needed - Model Association

2010-12-30 Thread John L
as *comments*only I guess the problem is in the relationship type during the model association ? Not sure though Thanks Karthikeyan P On Thu, Dec 30, 2010 at 4:08 AM, john lyles confidentia...@gmail.comwrote: If the model names are Post and User then the table names should be 'posts' and 'users

URGENT - Help needed - Model Association

2010-12-29 Thread pinastro
I have created a Blog Application using a base table as 'Posts'. Later Model-Associated with another table 'Users' with 'belongsTo' relationship like below in the MODEL var $belongsTo = array( 'User' = array( 'className' = 'User', 'foreignKey' = 'user_id', 'conditions' = '', 'fields' = '',

Re: URGENT - Help needed - Model Association

2010-12-29 Thread john lyles
If the model names are Post and User then the table names should be 'posts' and 'users' lowercased. The field name is 'user_id' not 'UserId'. Model 'Comment' has a 'comments' table, not a 'Comments' table. You have to respect CakePHP's File and Classname conventions, see section 2.4.1 in the

Re: URGENT - Help needed - Model Association

2010-12-29 Thread Karthikeyan P
*only I guess the problem is in the relationship type during the model association ? Not sure though Thanks Karthikeyan P On Thu, Dec 30, 2010 at 4:08 AM, john lyles confidentia...@gmail.comwrote: If the model names are Post and User then the table names should be 'posts' and 'users' lowercased

Model association, I've made it correctly???

2010-10-17 Thread Mariano C.
I'm studing model associations, I would know if i've understand it correctly: I have five tables: users, books, books_users, authors and types. users, authors and types just have PK field called id. books have PK called id and FK called author_id (ref. Authors) books_users have PK called id and 3

Re: Model association, I've made it correctly???

2010-10-17 Thread euromark
you probably meant Type hasMany BooksUser... On 17 Okt., 22:17, Mariano C. mariano.calan...@gmail.com wrote: I'm studing model associations, I would know if i've understand it correctly: I have five tables: users, books, books_users, authors and types. users, authors and types just have PK

Re: Model association problem - not getting expected array using $hasMany and $belongsTo association

2010-10-12 Thread cricket
Everything appears to be correct. Try deleting any files in app/tmp/cache/models/ if you haven't already. And set debug to 2, both so the models won't be cached and so you can see what queries are being run. On Mon, Oct 11, 2010 at 2:04 PM, Ashwani Kumar ashwani.mail...@gmail.com wrote: Hi all!

Model association problem - not getting expected array using $hasMany and $belongsTo association

2010-10-11 Thread Ashwani Kumar
Hi all! Today was trying to learn associations but i couldn't succeed. I'm getting some issue in getting associated array. I've two tables : authors - id - name - email - website books - id - isbn - title - description -

How to attach model association belongsTo on the fly?

2010-04-23 Thread Ziki
How to attach model association belongsTo on the fly? I ama developing plugin so I need that, to attach somewhere in my component. Help please Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you

general model association/SQL question: linking one table to many others

2010-04-14 Thread Vadim Frolov
Hi! I have a table phrases. It has fields id as INT and value as TEXT. This table is used to store different phrases or sentences. Now I want to describe a car with a model name and description. I want both these values to reference phrases table. In my opinion Car hasOne name and hasOne

Re: general model association/SQL question: linking one table to many others

2010-04-14 Thread cricket
On Apr 14, 12:34 pm, Vadim Frolov fra...@gmail.com wrote: Hi! I have a table phrases. It has fields id as INT and value as TEXT. This table is used to store different phrases or sentences. Now I want to describe a car with a model name and description. I want both these values to reference

Re: general model association/SQL question: linking one table to many others

2010-04-14 Thread Vadim Frolov
yes, I do so because I want to translate my phrases. I would use CakePHP to translate interface, but also want my actual data to be in several languages. Seems that creating additional table for each field is the only way to go =( Regards, Vadim. On 15 April 2010 04:44, cricket

Re: Better way to handle this model association

2010-03-23 Thread WebbedIT
If there is no validation I would probably create my data array so you have one Review with Many ServiceTypes, each with its many Criterias. In the controller I would then save the Review before looping through each ServiceType using saveAll to save ServiceType and it's many Criteria. This

Re: Better way to handle this model association

2010-03-22 Thread jwerd
Paul, First off, Thanks for taking a look. I guess I am just confused on how I can go about the associations, since my ratings table is storing specific based on the editorial_review_id's service_type_id, if that makes sense. Essentially, someone creates a review, and they drill down with the

Re: Better way to handle this model association

2010-03-22 Thread WebbedIT
OK, so you're trying to save hasMany records each with their own HABTM, there is no automagic that will do that for you hence why you've had to try and come up with your own solution. Are you sure it's not easier to save just one review/serviceType combo at a time? By trying to do lots in one go

Re: Better way to handle this model association

2010-03-22 Thread jwerd
Paul, This is how the end product looks: http://farm5.static.flickr.com/4039/4453982845_d2908b4527_o.png Basically, when a user selects a service type (checks it) it spawns a box below, with the rating criterias, etc (I handle that with jquery and all that jazz, of no importance ot this though).

Re: Better way to handle this model association

2010-03-21 Thread WebbedIT
I'm slightly confused, why do you have to massage the data array? What part of your save process is not working, I'm guessing your saying it is not autosaving the HABTM data. If so, what does your submitted data array and save action look like? HTH Paul Check out the new CakePHP Questions site

Better way to handle this model association

2010-03-20 Thread jwerd
Ok, I'm going to try to make this quick. This _works_ but I think there is a better way to do it. Tables: CREATE TABLE `ratings` ( `id` int(11) unsigned NOT NULL auto_increment, `rating_types_id` tinyint(3) default NULL, `editorial_reviews_id` int(11) default NULL, `service_types_id`

Model association through user_id

2010-03-17 Thread abocanegra
I am trying to learn more about associating through models. My current issue is that I am attempting to design the post add function that I created following the tutorial so that I can select the user by username rather than user_id. I want to have the value of the drop down be user_id and the

Re: Model association through user_id

2010-03-17 Thread cricket
In User model: var $displayField = 'username'; Then find('list') will return an array as id = username On Mar 17, 8:50 pm, abocanegra aaronbocane...@gmail.com wrote: I am trying to learn more about associating through models. My current issue is that I am attempting to design the post add

Re: Model association through user_id

2010-03-17 Thread abocanegra
Thank you for the response. I was able to get it working finally by the following code int he postscontroller under the add function. $users = $this-Post-User-find('list', array('fields' = array('User.username'))); $this-set(compact('users')); Thanks On Mar 17, 7:27 pm, cricket

Model Association 'chain'

2010-02-24 Thread p_W
I have 4 models, associated like this: Model_1 has_many Model_2 Model_2 belongs_to Model_1 Model_2 has_many Model_3 Model_3 belongs_to Model_2 Model_3 has_many Model_4 Model_4 belongs_to Model_3 In my controller, when I call `$my_var = $this-Model_1-find('all')` the results have Model_1 and

Re: Model Association 'chain'

2010-02-24 Thread John Andersen
Take a look in the CakePHP manual at the Containable behaviour, which will give you the possibility to specify how deep you want to go in your relationships when retrieving your data. http://book.cakephp.org/view/474/Containable Also it will make your life easier :) Enjoy, John On Feb 24,

Re: Model Association 'chain'

2010-02-24 Thread WebbedIT
In the case of viewing a record, Containable is very much your friend. Saves you so much time. If paginating deep associations, espcially if you want a condition on model 3 or 4, then you need to get your head around ad-hoc (forced) joins.

Re: Problem with Model Association

2009-10-07 Thread Raman
wrote: In Comment.php, add var $belongsTo = array('NewsPost'); On Tue, Oct 6, 2009 at 1:02 PM, Raman rlali...@gmail.com wrote: Hello, Im very new to CakePHP and have just started to learn Model Association. If I make any errors in the google group, please excuse me this is my

Problem with Model Association

2009-10-06 Thread Raman
Hello, Im very new to CakePHP and have just started to learn Model Association. If I make any errors in the google group, please excuse me this is my first time on any google group. I have 2 databases: -news_posts -id -title -body -comments -id -body -newspost_id Here

Re: Problem with Model Association

2009-10-06 Thread brian
In Comment.php, add var $belongsTo = array('NewsPost'); On Tue, Oct 6, 2009 at 1:02 PM, Raman rlali...@gmail.com wrote: Hello, Im very new to CakePHP and have just started to learn Model Association. If I make any errors in the google group, please excuse me this is my first time on any

Re: Problem with Model Association

2009-10-06 Thread Raman
! On Oct 6, 2:15 pm, brian bally.z...@gmail.com wrote: In Comment.php, add var $belongsTo = array('NewsPost'); On Tue, Oct 6, 2009 at 1:02 PM, Raman rlali...@gmail.com wrote: Hello, Im very new to CakePHP and have just started to learn Model Association. If I make any errors in the google

Re: Problem with Model Association

2009-10-06 Thread brian
at 1:02 PM, Raman rlali...@gmail.com wrote: Hello, Im very new to CakePHP and have just started to learn Model Association. If I make any errors in the google group, please excuse me this is my first time on any google group. I have 2 databases: -news_posts    -id    -title

Model association validation

2009-09-30 Thread Daniel
Hi, I'm sorry if this is a silly question, but I just wanted to check this to make sure I get it right from the start. I've just finished building the tables that I'm going to use for my project and am about to use Bake to build the models. Some of the Models have BelongTo associations, i.e.

Auto-model association doesn't work

2009-08-20 Thread buzachis.a...@gmail.com
Hey everyone. I have 2 models: User (hasOne) Character (belongsTo) User. Everything works great on my laptop. When I move it to a server, somehow, it can't find associations in models. If I do a find('first', condition id) i get only the User (not the Character too, and YES it exists in DB),

Re: Auto-model association doesn't work

2009-08-20 Thread Brendon Kozlowski (Realm)
Have you tried clearing your app/tmp/cache folders to remove that as being the cause of the issue? On Aug 20, 4:19 am, buzachis.a...@gmail.com buzachis.a...@gmail.com wrote: Hey everyone. I have 2 models: User (hasOne) Character (belongsTo) User. Everything works great on my laptop. When I

Re: Auto-model association doesn't work

2009-08-20 Thread Dr. Loboto
Clear caches and check filenames. All files must be strictly lowercase. Cake just do not load your models as cannot find files. On Aug 20, 3:19 pm, buzachis.a...@gmail.com buzachis.a...@gmail.com wrote: Hey everyone. I have 2 models: User (hasOne) Character (belongsTo) User. Everything

Re: Model Association via conditions fails!

2009-07-23 Thread lapinski
any help on this issue. Regards. -- View this message in context: http://www.nabble.com/Model-Association-via-%22conditions%22-fails%21-tp23213390p24621578.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ You

Re: Model association problem

2009-07-17 Thread Zoran Kovac
Here are some of the table fields. it's the table USER, GROUPS and MEDICIANL DEVICE. In short relatons are: ser should be in one group and have many MedDevice, group should have one user, medicinal device should have only one user. CREATE TABLE IF NOT EXISTS `baza2`.`USER` ( `id` INT NOT NULL

Re: Model association problem

2009-07-17 Thread leop
The database table names ought to be plural, viz: MEDICINAL_DEVICES, USERS etc. Cake is intelligent enough to handle plurals such as COMPANIES (COMPANY). In the model definitions, the model will be the capitalised singular version of the tablename, e.g. User Foreign keys are singular, e.g.

Re: Model association problem

2009-07-17 Thread Carlos Lavin
Tables are supposed to be plural (users,groups,medicinal_devices) and the foreign keys singular(user_id,group_id...) Change it and give it another shot =) 2009/7/17 Zoran Kovac zoko2...@gmail.com Here are some of the table fields. it's the table USER, GROUPS and MEDICIANL DEVICE. In short

Re: Model association problem

2009-07-17 Thread Zoran Kovac
Aargh...name conventions, still not used to it. Thanks for the heads up, knew it had to be something obvoius. It always is ;)) Now it works like a charm. -- Zoran Kovac 091/ 588 6175 V.Gorica On Fri, Jul 17, 2009 at 9:53 AM, Carlos Lavin carloslavi...@gmail.comwrote: Tables are supposed to

Model association problem

2009-07-16 Thread Zoran Kovac
Hi! I'm having a dilema, maybe the better word is that I'm puzzled. The problem is when I'm baking models. The console doesn't detect relations between tables automatically. For instance, the console does recognize all the tables from the database, but when it's triying to detect associations

Re: Model association problem

2009-07-16 Thread Carlos Gonzalez Lavin
Maybe if you described the tables' fields.. theres gotta be some convention breaking there 2009/7/16 Zoran Kovac zoko2...@gmail.com Hi! I'm having a dilema, maybe the better word is that I'm puzzled. The problem is when I'm baking models. The console doesn't detect relations between

model association question

2009-06-18 Thread Jacob Everist
I have a project and I am trying to figure out the best way to associate my models and how to structure them. In particular, I have something like a polymorphic association situation. I want to have a table of transactions, that list the transfers of money from one user to another. The

Model association w/ multipart key

2009-05-21 Thread michaelc
Hi all. Just asking to rely on the wisdom of those with greater experience than me. My Settings model has fields id, group, key, and value, while my SettingOptions model has fields id, group, key, type, and default. My intent is to use the data available in the setting_options table to validate

Model Association based on user_id

2009-05-14 Thread Dan
I have two models, Content and Score. The Score model has a reference to a User (user_id) the Content model (content_id). Therefore, there can be many Scores associated with Content. So far, this is sounding like a cut-and-dry Content - hasMany - Score association, right? Now, when I retrieve

Re: Model Association Not Creating Query Joins

2009-04-25 Thread James K
Start from the AccountAlert model rather than the Alert model. Use contain as well. $alert_ids = $this-AccountAlert-find ( 'all', array ( 'contain' = array(), 'conditions'= array ( 'AccountAlert.account_id' =

Re: Model Association Not Creating Query Joins

2009-04-25 Thread Rob Wilkerson
On Apr 25, 9:55 am, James K james.m.k...@gmail.com wrote: Start from the AccountAlert model rather than the Alert model. Use contain as well. $alert_ids = $this-AccountAlert-find (         'all',         array (                 'contain' = array(),                 'conditions'    =  

Re: Model Association Not Creating Query Joins

2009-04-24 Thread Walther
In cases like what you are looking at it tends to work a bit better if you rather do the find on the model you want to filter. Something like: $alert_ids = $this-Alert-AccountAlert-find ( 'all', array ( 'conditions'= array (

Model Association via conditions fails!

2009-04-24 Thread ohneworte
Hello Together, I want to link two Models without using a Foreign Key, but using some Conditions instead. Here is my example: Model: - class Category extends AppModel { var $name = Category; var $actsAs = array(Containable); var $hasMany = array(

Model Association Not Creating Query Joins

2009-04-23 Thread Rob Wilkerson
I have an Alert model, an Account model and an AccountAlert model: Alert hasMany AccountAlert Account hasMany AccountAlert AccountAlert belongsTo ( Alert, Account ) AccountAlert has several other defining fields, so it has its own primary key in the database as well as being its own model. IOW,

Model association

2008-12-26 Thread mona
How to make association between three of four tables because i m fetching data on my table from three different tables --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email

Re: Model association

2008-12-26 Thread MikeB
var $hasmany = array('People', 'Post', 'Tag); On Dec 26, 11:51 am, mona poojapinj...@gmail.com wrote: How to make association between three of four tables because i m fetching data on my table from three different tables --~--~-~--~~~---~--~~ You received this

What's the Model Association for a Lookup Table

2008-12-13 Thread Rob Wilkerson
I have a vendors table that contains a field named address_id that is a foreign key to addresses.id. If I define the models as shown below then I'm unable to request a scaffolded version of /vendors/ without getting an error: Unknown column 'Address.vendor_id' in 'on clause'. I don't want a

Re: What's the Model Association for a Lookup Table

2008-12-13 Thread Rob Wilkerson
Rob Wilkerson wrote: I have a vendors table that contains a field named address_id that is a foreign key to addresses.id. If I define the models as shown below then I'm unable to request a scaffolded version of /vendors/ without getting an error: Unknown column 'Address.vendor_id' in 'on

HABTM Model association trouble.

2008-12-10 Thread Genu
Hello, I'm using the HABTM model association, with my database structure as follows: table: contractors fields: Id name address state zip fax table: projects fields: id title address state zip type value size ..etc. a join table: contractors_projects fields: id contractor_id project_id My

Auth - User model association problem

2008-10-09 Thread Duncan
Hi, I have a User model, which belongsTo a Group model. When using the user model itself, I get the correct association data for the Group model, but when using the Auth component, then I only get the User model itself in the auth session array, e.g.: [Auth] = Array ( [User]

Recursive Model association

2008-09-28 Thread [EMAIL PROTECTED]
Hey Bakers, what is wrong in this association ? I can't get the recursive Relation running. I need the location name for routing the image. It should be stored in. But is doesn'exists. $data[Picture][Gallery][Location][location_name] Here is the code: ?php class Gallery extends AppModel {

Model association

2008-09-17 Thread VitillO
Hi, i have the following structure for a tshirt online store: Product HABTM Size Size HABTM Product Association table: products_sizes The problem is, i need a stocks system. For example, say i have 50 pieces of S (size) for a particular tshirt, before using cake i had a column 'stock' in the

Re: Model association

2008-09-17 Thread Luiz Poleto
You can create the column stock in the association table.In the form where you do the association, you can add a new field for the stock. At least that was what i understood from your question... Regards, Luiz Poleto 2008/9/17 VitillO [EMAIL PROTECTED] Hi, i have the following structure for

Re: Model association

2008-09-17 Thread Adam Royle
You can create a model for your habtm association so you can add extra fields, etc, using the with key. Something like this... class Product extends AppModel { ... var $hasAndBelongsToMany = array( 'Size' = array('className' = 'Size', 'with' = 'ProductsSize', // -- this here, class

Re: Model association

2008-09-17 Thread VitillO
Hi guys, thanks for your replies. Right now, im my 'add' view of products, im getting a multiple select for the sizes, where i can select which sizes are available for that particular product, thats fine. The problem is that i need a stock number for each of this available sizes, so a multiple

Re: Model association

2008-09-17 Thread teknoid
I explain how with work here, I think this should be good to get you started: http://teknoid.wordpress.com/2008/07/03/notes-on-cakephp-habtm-part-1-the-basics/ Also, just a hint... cake can easily create checkboxes for you (instead of multi-select). Just tell it to use 'multiple'='checkbox' in

Re: Model association

2008-09-17 Thread VitillO
Ok guys, it seems i have the data (extra field 'stock' in the association table) in $this-data when i edit a Product, something like this, so the association table is auto-modelized: [Size] = Array ( [0] = Array ( [id] = 2

Model association question

2008-07-03 Thread jhicks
OK, so I've got two tables: tasks and priorities. Many tasks can share the same priority. So is this a HABTM relationship? With HABTM, you usually have a join table but in my situation I don't need one. I just have a foreign key in my tasks table (priority_id) which points to the index of the

Re: Model association question

2008-07-03 Thread John David Anderson
I always remember it like this: If a table contains a foreign key, it's like a little label that another object has put on it... i.e. it belongsTo something else. hth/fwiw, John On Jul 3, 2008, at 1:38 PM, Jonathan Snook wrote: A priority hasMany tasks. A task belongsTo a priority.

Re: Model association question

2008-07-03 Thread francky06l
@Jonathan, yes it always a bit confusing the hasOne (in Cake).. because a Task hasOne priority, no matter if this priority is shared .. but for cake it'a a belongsTo .. :-) Even after using for few months (years)... hasOne always make me think twice (actually I use it very rarely).. On Jul 3,

problem with conditions in model association

2008-07-02 Thread bmgz
Hi All, I am new to Cake 1.2, (dabbled with 1.? a year ago, but spend more time with Rails..) I am really getting into this framework, it is really fun, much better than earlier versions. I am however stuck with a problem relating to model associations: Consider the following in my Contract

Custom Model Association Problems

2008-06-16 Thread benjam
I have the following tables with the following fields territories - id zip_start zip_end offices - id zipcode and I want to associate via hasMany and belongsTo on the following conditions (territories hasMany offices) and (offices belongsTo

Re: Plugin Model Association Problem

2008-05-25 Thread biesbjerg
Add var $name = 'User'; var $name = 'UserProfile'; as properties in your models and I think you're golden :-) On May 24, 10:19 am, francky06l [EMAIL PROTECTED] wrote: Can you pass your model definition code ? I have the same kind of plugin and not much problems, maybe I declare the

Re: Plugin Model Association Problem

2008-05-24 Thread francky06l
Can you pass your model definition code ? I have the same kind of plugin and not much problems, maybe I declare the association in different way. I set the plugin name into the className parameter ie : belongTo = array('Profile' = array('className' = 'user.Profile') Wich cake version are

Plugin Model Association Problem

2008-05-23 Thread Christopher E. Franklin, Sr.
('users.User', 'users.UserProfile'); This works perfectly and I can create a user and a user profile and it saves just fine. The problem is when I try to find the user. In my model association I have to have: $belongsTo = 'users.User'; and $hasOne = 'users.UserProfile'; or else it will say

Re: Plugin Model Association Problem

2008-05-23 Thread francky06l
If the user model is in the plugin it should not a problem.. Maybe the problem is how you call the find and from where ? The problem is when I try to find the user. In my model association I have to have: I guess this is when you try to find user from the application and not the plugin ? Maybe

Re: Plugin Model Association Problem

2008-05-23 Thread Christopher E. Franklin, Sr.
On May 23, 2:49 pm, francky06l [EMAIL PROTECTED] wrote: If the user model is in the plugin it should not a problem.. Maybe the problem is how you call the find and from where ? I do the find in the UsersController::read() function. It seems to me that it is a problem with the association

Re: Test Suite v1.2: $useDbConfig problem in model association.

2008-04-17 Thread Defranco
Should I report the fact that $model-setDataSource($dbConfig) do not affect related models as a bug or as an enhancement? Actually, if I set $model-setDataSource('test_suite'); Related model like $model-Model2 will still have $dbConfig='default' not $dbConfig='test_suite' as the main model -

Re: Test Suite v1.2: $useDbConfig problem in model association.

2008-04-10 Thread releod
thanks for posting that - I was running into the same problems, all is well now. According to the passing tests :) On Mar 20, 5:20 pm, Defranco [EMAIL PROTECTED] wrote: Hi again, Please discard the code from previous post, it has a lot of bugs. This is working better:

Model Association

2008-02-25 Thread Darkman_dd
Hello, i have a question: i have a model named admin where the admins of the site can write an article, edit it, delete it etc. It's assosiated with model section so every article must belong to a section. How can i make a model articles that doesn't have a database connected to it but it can

Re: Model Association Query....stumped

2008-02-08 Thread EchoChargen
I've done the following: Clipranking Model: function findClipByRank($site_id){ return $this-query(SELECT Clipranking.rank, Clipranking.site_id, Clipranking.required, Clip.id, Clip.name, Clip.length FROM cliprankings AS Clipranking, clips AS Clip WHERE Clipranking.site_id =

Model Association Query....stumped

2008-02-07 Thread EchoChargen
All - I've been using Mariano Iglesias Bindable behavior with 1.2 beta to nice effect, but I've run into a query I can't figure out. Here's what I have: Team hasMany Clip Team hasMany Site Site hasMany Clipranking A Site can play any of the Clips available in their Team in whatever ranked order

Re: Model Association without Foreign key (Cake 1.18)

2008-02-06 Thread Bo-oz
should be taken. Any thoughts on how to use a model association (if this is possible) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com

Model Association without Foreign key (Cake 1.18)

2008-02-06 Thread Bo-oz
', 'foreignKey'=false) ); } The idea should be to finally make a condition which bounds the date, so that I know which VAT-rate should be taken. Any thoughts on how to use a model association (if this is possible

  1   2   >