Re: How to associate 3 models (or structure a search) to achieve the following structure (Cake 2.x)

2014-12-22 Thread Chris
Hi John thanks for the reply. 

I'm not sure the purpose of the tables will help with a solution but here 
goes to be honest your description I think is right.

The Customer table stores information about the actual business. e.g. 
Starbucks. So if my customer is Starbucks, this table will identify the 
customer for things like invoicing etc. CustomerAddress would store the 
addresses of the coffee shops. CustomerContact would store details of 
people who work for Starbucks. 

Using my first example, you could search for contacts at a particular 
address maybe for an email alert or something pertaining to that location. 
Maybe this way you would also work out engineer mileage to a location. 

Using my second example, you could search for a contact, for example making 
an appointment with them, then have their address details attached. Using 
this method, you could also assign a billing contact and use their details 
to send invoices etc... 

Hope this helps?



On Monday, December 22, 2014 4:29:03 PM UTC, John Andersen wrote:
>
> Please describe your Customer and Contact with more words. What are they 
> in relation to each other?
>
> For example:
> We register information on our customers. For each customer, we have 
> registered the employees that we use as contact when we wish to contact the 
> customer on specific subjects.
>
> The customer has a main office in one location and several other offices 
> in other locations. Thus we need also to know which of the contact people 
> are located in the specific location/office.
>
> When you try and describe the relation between customer and contacts and 
> other objects that may be of interest, then it will be easier for us to 
> help you :)
>
> Enjoy, John
>
>
> On Sunday, 21 December 2014 01:33:43 UTC+2, Chris wrote:
>>
>> Hi all!
>>
>> I'm quite new to Cake and this is my first project. 
>>
>> I'm working on a customer database. For larger business customers the 
>> relationships get a little complicated. I have 3 models, Customer, 
>> CustomerAddress and CustomerContact. A customer can have many addresses, 
>> and many contacts, but the contacts are also based at one address so an 
>> address has many contacts.
>>
>> The end result I'm trying to achieve is to be able to search the data 
>> both ways, e.g.
>> Customer -> Address 1 -> Contact 1
>>  Contact 2
>>  Contact 3
>>  
>>
>> Address 2 -> Contact 1
>>  
>> 
>>
>>
>> Or
>>
>> Customer -> Contact 1 -> Address
>> Contact 2 -> Address
>> 
>>
>> I currently have it working as the first example, but found this 
>> problematic when I wanted to search the contacts, I have to search all the 
>> addresses too. If I search the contact I want to be able to get the address 
>> for that contact too, as in the second example. 
>>
>> I'm not sure how to set this up, bit of help would be much appreciated to 
>> get me on the right track.
>>
>> TIA! 
>>
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: How to associate 3 models (or structure a search) to achieve the following structure (Cake 2.x)

2014-12-22 Thread John Andersen
Please describe your Customer and Contact with more words. What are they in 
relation to each other?

For example:
We register information on our customers. For each customer, we have 
registered the employees that we use as contact when we wish to contact the 
customer on specific subjects.

The customer has a main office in one location and several other offices in 
other locations. Thus we need also to know which of the contact people are 
located in the specific location/office.

When you try and describe the relation between customer and contacts and 
other objects that may be of interest, then it will be easier for us to 
help you :)

Enjoy, John


On Sunday, 21 December 2014 01:33:43 UTC+2, Chris wrote:
>
> Hi all!
>
> I'm quite new to Cake and this is my first project. 
>
> I'm working on a customer database. For larger business customers the 
> relationships get a little complicated. I have 3 models, Customer, 
> CustomerAddress and CustomerContact. A customer can have many addresses, 
> and many contacts, but the contacts are also based at one address so an 
> address has many contacts.
>
> The end result I'm trying to achieve is to be able to search the data both 
> ways, e.g.
> Customer -> Address 1 -> Contact 1
>  Contact 2
>  Contact 3
>  
>
> Address 2 -> Contact 1
>  
> 
>
>
> Or
>
> Customer -> Contact 1 -> Address
> Contact 2 -> Address
> 
>
> I currently have it working as the first example, but found this 
> problematic when I wanted to search the contacts, I have to search all the 
> addresses too. If I search the contact I want to be able to get the address 
> for that contact too, as in the second example. 
>
> I'm not sure how to set this up, bit of help would be much appreciated to 
> get me on the right track.
>
> TIA! 
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


How to associate 3 models (or structure a search) to achieve the following structure (Cake 2.x)

2014-12-21 Thread Chris
Hi all!

I'm quite new to Cake and this is my first project. 

I'm working on a customer database. For larger business customers the 
relationships get a little complicated. I have 3 models, Customer, 
CustomerAddress and CustomerContact. A customer can have many addresses, 
and many contacts, but the contacts are also based at one address so an 
address has many contacts.

The end result I'm trying to achieve is to be able to search the data both 
ways, e.g.
Customer -> Address 1 -> Contact 1
 Contact 2
 Contact 3
 

Address 2 -> Contact 1
 



Or

Customer -> Contact 1 -> Address
Contact 2 -> Address


I currently have it working as the first example, but found this 
problematic when I wanted to search the contacts, I have to search all the 
addresses too. If I search the contact I want to be able to get the address 
for that contact too, as in the second example. 

I'm not sure how to set this up, bit of help would be much appreciated to 
get me on the right track.

TIA! 

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.