Friday, October 2, 2009

Re: Help with Multiple Models + Single View required

My idea is ... that's a lot of text !

Ok j/k, what exactly are you asking for ?

On Thu, Oct 1, 2009 at 9:28 PM, ashok.b <email2ash@gmail.com> wrote:

Hi everyone, I'm new to this group and to cakephp. I'm enjoying
writing code with cakephp, and most of times I'm getting help from the
bakery, community and googling. But am at a roadblock now, and seems
like I can't find what I am looking for. My problem is as follows:

Table1: tbl_messages
id - integer - Auto Increment Primary Key
msg - varchar - A text message

Table2: tbl_accounts
id - integer - Auto Increment Primary Key
username - varchar - User Name of the Account
userpass - varchar - Password for the Account

Table3: tbl_batches
id - integer - Auto Increment Primary Key
bname - varchar - Name of the Batch
bdesc - varchar - Description of the Batch

Table4: tbl_jobs
id - integer - Auto Increment Primary Key
tbl_messages_id - integer - Foreign key referring to tbl_messages
tbl_accounts_id - integer - Foreign key referring to tbl_accounts
tbl_batches_id - integer - Foreign key referring to tbl_jobs
schedtime - datetime - Date Time when to send the message

The table4 contains details of jobs which will be executed using cron
job. My problem now is to create a single view, which will:

1. Display a Message
2. Select a single/multiple Account/es
3. Select a single/multiple Batch/es
4. Take input date & time

On clicking submit,
Multiple entries to be inserted in tbl_jobs, depending on number of
items selected in Accounts & Batches (i.e. if 2 accounts, 2 batches
are selected, 4 entries to be made into tbl_jobs with values
(x,msgid,accid1,batchid1,datetime)
(x,msgid,accid1,batchid1,datetime)
(x,msgid,accid2,batchid2,datetime)
(x,msgid,accid2,batchid2,datetime)

The view is achieved using the Messages Model. But from there, data
from the form should be sent to Job Model which should insert in above
format.

Any ideas please... Thanks for patiently reading the loooong post.




--~--~---------~--~----~------------~-------~--~----~
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 unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: