Am have a dilemma...
I have a store that sells eTickets & physical tickets. Details of the
sale of each type of ticket are stored in 2 tables (etickets &
ptickets).
I also have a table that stores details of when a user is directed off
to PayPal to pay for their tickets (paypal_transactions).
I've been trying to work out the best way to setup the relationships
here. Originally I setup 2 join tables between the
paypal_transactions & the different ticket types tables, with a HABTM
relationship, however this doesn't quite feel right, as there can be
many transactions per ticker (if payments fail), but not multiple
tickets per transaction.
My other thoughts on options were...
1. Add a eticket_id & a pticket_id field to the transactions table
(but this does not securely stop a transaction having both a
eticket_id & a pticket_id).
2. Add a 'type' column in the paypal_transactions for 'ticket_type' &
then setup 2 models for the transactions table with some kind of
filter on the find methods to limit it to only the appropriate record
2a. As 2, but have a single model & use the conditions property of the
hasMany association to limit the records returned.
None of these options seem to protect against a transaction being
associated to both an eticket & a pticket at the same time, & whenever
I've tried to add validation to a foreignKey field in the past it's
caused problems with my saveAll statements.
Any help of advice on this one would be greatly appreciated.
Thanks,
T
--
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 related questions.
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
No comments:
Post a Comment