i have 4 types of users for User table 1) admin 2) agent 3) advertiser
4) client.
Onc real estate property have three users like client of that
property, agent of that property and advertiser. how should i get 3
users from the same 'User table' for one property so i can show them
in property detai
For your information, your database tables does not comply with the
CakePHP conventions!
"Join tables, used in hasAndBelongsToMany (HABTM) relationships
between models should be named after the model tables they will join
in alphabetical order (apples_zebras rather than zebras_apples)"
Thus your
Your SQL statement has an error in:
INNER JOIN tags ON tag_images.id = tags.id
Change to:
INNER JOIN tags ON tag_images.tag_id = tags.id
But how is your CakePHP find statement looking like?? That I would
much better like to see!
Enjoy,
John
On May 17, 12:16 pm, Dilip Godhani wrote:
> its
Then why do you think that Cake can fix that? If you want to run a query
directly in Cake (which is generally a bad thing) get it working in SQL first.
Jeremy Burns
jeremybu...@me.com
On 17 May 2010, at 10:16, Dilip Godhani wrote:
> its not give me right output...!
>
> On Mon, May 17, 2010 at
its not give me right output...!
On Mon, May 17, 2010 at 2:42 PM, Jeremy Burns wrote:
> What happens when you run that sql in an SQL client?
>
> Jeremy Burns
> jeremybu...@me.com
>
>
> On 17 May 2010, at 10:09, Dilip Godhani wrote:
>
>
> also i create one manual query but it is also not working
What happens when you run that sql in an SQL client?
Jeremy Burns
jeremybu...@me.com
On 17 May 2010, at 10:09, Dilip Godhani wrote:
>
> also i create one manual query but it is also not working can u check my
> manual query???
>
>
> $this->set('image1',$this->Image->query("
> S
also i create one manual query but it is also not working can u check my
manual query???
$this->set('image1',$this->Image->query("
SELECT images.* FROM images
INNER JOIN image_students ON images.id = image_students.image_id
LEFT OUTER JOIN tag_images ON images
Hello sir,
i understand that relationship but it is not working...!
On Mon, May 17, 2010 at 2:01 PM, John Andersen wrote:
> Can I assume that you do understand about ER models (Entity-
> Relationship models) and thus about relationships between your tables
> in your database?
>
> If you do unde
Can I assume that you do understand about ER models (Entity-
Relationship models) and thus about relationships between your tables
in your database?
If you do understand that, then please read carefully the CakePHP book
on associating/relating models to each other in:
http://book.cakephp.org/view/
Yesalll thing is ok but i cnt understood raltionship
can u tell me wich model which realationship i give in model file
Thanks...!
On Mon, May 17, 2010 at 12:50 PM, John Andersen wrote:
> Ok :)
> Assuming that your models then also are named in accordance with the
> CakePHP conventions, your
Ok :)
Assuming that your models then also are named in accordance with the
CakePHP conventions, your models should be related as follows (defined
in the respective models):
Tag hasAndBelongsToMany Image
Image hasAndBelongsToMany Tag
Student hasAndBelongsToMany Image
Image hasAndBelongsToMany Stud
yes sir i give that name accordance with the CakePHP?
But i not working can u explain me step by step?plz
Thanks
On Mon, May 17, 2010 at 12:31 PM, John Andersen wrote:
> Ok, step by step!
>
> Please clarify, are your tables named in accordance with the CakePHP
> conventions?
>
> Tables:
> tags,
Ok, step by step!
Please clarify, are your tables named in accordance with the CakePHP
conventions?
Tables:
tags, students, images, images_students, and images_tags
Enjoy,
John
On May 17, 9:36 am, Dilip Godhani wrote:
> hello sir
>
> Can u explain in details?
> I cant understood sir?
>
> Pl
gt;
> > Tag --- id,tag_name
> >
> > Image -- id,image_name
> >
> > Student-- id,fname,lname
> >
> > tag_image--id,image_id,tag_id
> >
> > Image_student ---id,image_id,student_id
> >
> > I want to find record using tag_name and stud
e
>
> Student-- id,fname,lname
>
> tag_image--id,image_id,tag_id
>
> Image_student ---id,image_id,student_id
>
> I want to find record using tag_name and student_id can anyone help me
> how i give relationship in model ,also i try following example,can any
> one give m
example,can any
one give me manual query for that...!
http://stackoverflow.com/questions/2827372/relationship-problem
Thanks...!!!
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are
This looks like your classic e-commerce shop with multi-level
categories and items which could belong to multiple categories.
I would say you need to look at Cake's Tree Behaviour for the
categories (not used it yet myself, but is very good) and your Item
model would then have a HABTM association
- i have 3 tables : Categories, Subs , Items
- when i do a findAll() on the Category model, am having a problem
- let's say i have these data entered into the tables:
- example: Category: computer , Sub: Software , Sub:Hardware , Item:
Mouse , Item : 3dstudioMax
am trying to achieve this but with
What Travis said :)
2009/6/30 Travis L
>
> Carlos is right, but he was a little implicit in his answer.
>
> The short answer is that the Agency belongsTo Seller means that each
> agency belongs to only one seller. It wants a seller_id field in the
> agency table (which is how the relationship i
Carlos is right, but he was a little implicit in his answer.
The short answer is that the Agency belongsTo Seller means that each
agency belongs to only one seller. It wants a seller_id field in the
agency table (which is how the relationship is linked).
>From what I understand, you want the Se
How about:
*Seller Model:
*
*belongsTo agency*
*
*
*Agency Model:
**hasMany seller*
*
*
Because Agency doesn't really belong to the seller... an agency has many
sellers (if I understand you correctly) and a seller belongs to an agency
2009/6/30 Bryan Paddock
>
> Hey JD,
>
> Ah... I'm confused a
Hey JD,
Ah... I'm confused as to why I would need a HABTM and a join table for
a fairly simple relationship.
example of the structure:
Seller.id
Seller.name
Seller.agency_id
etc
and
Agency.id
Agency.name
etc
Each seller can only belong to one agency.
Each agency can have any number of seller
You need to look at hasAndBelongsToMany
http://book.cakephp.org/view/83/hasAndBelongsToMany-HABTM
Bryan Paddock wrote:
> Argh.. I hate gmail shortcut keys.
>
> Anyways continuing mail:
>
> Heya all,
>
> Theres something I'm not doing right here...
>
> I have a User model which has one Seller mode
Argh.. I hate gmail shortcut keys.
Anyways continuing mail:
Heya all,
Theres something I'm not doing right here...
I have a User model which has one Seller model linked to it which in
turn can have an Agency model linked to it.
User Model:
hasOne seller.
Seller Model:
belongsTo user
Agency
Heya all,
Theres something I'm not doing right here...
I have a User model which has one Seller model linked to it which in
turn can have an Agency model linked to it.
User Model:
hasOne seller.
Seller Model: belongsTo user
Agency Model: belongsTo seller
--~--~-~--~~~--
Looking through cake/libs/model/model.php I don't see anywhere in
saveAll where a check is done for a hasone association. (May have
missed it). I don't see how it could do this by default in any case.
It could recognize the hasone association but then how would it verify
uniqueness. It couldn't
Anyone ... pls a little help will be appreciated in the following
part..
> , but testing the application i was able to
> create a second profile for one user.
> I was guessing if thehasOneassociation should check that and return
> an error, or I am missing something?
Thnx
On May 5, 5:51 pm,
Thanks Paulos for your advice. I could certainly add some manual
checking before adding a child record. The question I am having in my
mind is that should duplicate check be done by the hasOne relationship
or is it possible. Am I missing anything here?
Robin
On May 5, 2:27 am, paulos nikolo wro
Hi Robin.I am not an expert coz i am trying to build a similar app of yours
so i ll tell you my opinion.As i saw your tables format i think you should
set depentent=true in user model and the exslusive field in profile model
true.The 1st one will delete the associated profile if the user has been
d
Hello, i'm new both to php and cake, so please excuse me if this is
another obvious noob question.
I was trying to understand how associations work by building up the
example in the manual section of cakephp.org, i was able to build it
up using bake with no much effort.
The thing is, i have a us
that worked. thank you very much
On 12 Gen, 19:42, Webweave wrote:
> You just need to set the recursive level to fetch the data that is not
> directly related. See:http://book.cakephp.org/view/439/recursive
>
> Set it before you do your find, or in the individual action.
>
> On Jan 8, 11:20 pm,
You just need to set the recursive level to fetch the data that is not
directly related. See: http://book.cakephp.org/view/439/recursive
Set it before you do your find, or in the individual action.
On Jan 8, 11:20 pm, Ernesto wrote:
> Hello and thx for the fast response.
>
> i forgot to paste t
Hello and thx for the fast response.
i forgot to paste the var $primaryKey in my model's code. sorry.
everything is working fine in my app. i just can't fetch Location
Types starting from persons. i'll take a look @ containable behaviour.
thx again
On 8 Gen, 21:43, Webweave wrote:
> Since you
Since you are using "non-standard" names for your ID columns, you need
to specify $primaryKey in your models, so your Person model, you would
need:
$primaryKey = 'location_id';
If you set debug to 2 or 3, you'll see the queries being executed. You
may need to set recursive to get the non-related
Table names are lower_case_undescored_plural while model names are
FirstCapsSingular, so:
your tables should be:
- persons
--- id <--- using id as primary key makes your life a lot easier
--- name
--- surname
- locations
--- id
--- person_id
--- location_type_id
--- address
--- country
- locatio
Hello.
i have 3 models
- Person
- Location
- Location_Type
pointing respectively @ 3 tables:
Persons:
person_id
name
surname
Locations:
location_id
person_id
location_type_id
address
country
Location_Types:
location_type_id
description
the 3 models are linked as follow:
Person hasMany Locati
You're overwriting array keys. Name the association something
different (but keep the className pointing to the proper model), and
you'll be on your way.
-J.
On Oct 18, 12:05 am, imu <[EMAIL PROTECTED]> wrote:
> Hi,
> I have problem with ORM (m-n) to relationship.
>
> http://farm4.static.flickr
Hi,
I have problem with ORM (m-n) to relationship.
http://farm4.static.flickr.com/3171/2950137747_b098638c67.jpg?v=0 ERD
image
The table categories is related to itself using m-n relationship. To
make this possible I created a new mapping table called as
categories_categories.
This is the HBT
38 matches
Mail list logo