# |
Jan 30th 2014, 19:59 |
BackEndCoder |
with some pretty arrays of data |
# |
Jan 30th 2014, 19:59 |
BackEndCoder |
i singular save(); etc |
# |
Jan 30th 2014, 19:58 |
BackEndCoder |
then a normal hasMany will be fine |
# |
Jan 30th 2014, 19:58 |
the-neon |
it's an admin panel but I was thinking a form per customer |
# |
Jan 30th 2014, 19:58 |
BackEndCoder |
otherwise it will look just has a normal hasMany save |
# |
Jan 30th 2014, 19:58 |
BackEndCoder |
if its an admin panel, and you are doing it for more than one customer a saveall is required |
# |
Jan 30th 2014, 19:58 |
the-neon |
ACTION [~]# cake quien es tu papi |
# |
Jan 30th 2014, 19:58 |
BackEndCoder |
infact you don't have to use a saveall, if you are doing it for a singular customer |
# |
Jan 30th 2014, 19:58 |
the-neon |
hmmmm |
# |
Jan 30th 2014, 19:57 |
BackEndCoder |
^^ |
# |
Jan 30th 2014, 19:57 |
todds |
you'll still need to generate entries as necessary, but if a customer doesn't receive a custom price, then don't generate an entry. |
# |
Jan 30th 2014, 19:57 |
the-neon |
(a CustomerPrice row I mean ) |
# |
Jan 30th 2014, 19:56 |
the-neon |
that would create a row for each product... so that's where I've been wrong? |
# |
Jan 30th 2014, 19:56 |
BackEndCoder |
you would use a saveAll |
# |
Jan 30th 2014, 19:56 |
the-neon |
I was thinking of a form listing price fields for each active product in the DB |
# |
Jan 30th 2014, 19:56 |
BackEndCoder |
yeah exactly, could it would be linking for no reason |
# |
Jan 30th 2014, 19:56 |
the-neon |
how would I go if I need the customer to be able to mass overwrite the product prices? |
# |
Jan 30th 2014, 19:55 |
todds |
and, more importantly, the row doesn't mean anything. |
# |
Jan 30th 2014, 19:55 |
BackEndCoder |
thats a lot of rows |
# |
Jan 30th 2014, 19:55 |
BackEndCoder |
cause everyone customer for every product would needa row |
# |
Jan 30th 2014, 19:55 |
todds |
^^ +1 |
# |
Jan 30th 2014, 19:55 |
BackEndCoder |
don't use null |
# |
Jan 30th 2014, 19:55 |
BackEndCoder |
if its not, its default |
# |
Jan 30th 2014, 19:55 |
BackEndCoder |
its overridden |
# |
Jan 30th 2014, 19:55 |
BackEndCoder |
if the row is there |
# |
Jan 30th 2014, 19:55 |
BackEndCoder |
yeah |
# |
Jan 30th 2014, 19:55 |
the-neon |
this is an override per customer |
# |
Jan 30th 2014, 19:55 |
the-neon |
Product model has a price field |
# |
Jan 30th 2014, 19:54 |
the-neon |
the product price is used |
# |
Jan 30th 2014, 19:54 |
BackEndCoder |
you just wouldn't have the association in the table |
# |
Jan 30th 2014, 19:54 |
the-neon |
if it's null it doesn't take it under account |
# |
Jan 30th 2014, 19:54 |
BackEndCoder |
you wouldn't want it to be null |
# |
Jan 30th 2014, 19:54 |
the-neon |
si senior |
# |
Jan 30th 2014, 19:54 |
BackEndCoder |
and if its null its the default price for the product ? |
# |
Jan 30th 2014, 19:54 |
BackEndCoder |
yeah thats what you want |
# |
Jan 30th 2014, 19:54 |
the-neon |
with id, customer_id, product_id, price ( can be null ) |
# |
Jan 30th 2014, 19:53 |
the-neon |
I've made a new model/table CustomPrice which belongsTo Customer, Product and on the other way it's hasMany |
# |
Jan 30th 2014, 19:53 |
BackEndCoder |
yeah its a hasthu assoc, matching the price each time |
# |
Jan 30th 2014, 19:53 |
todds |
the-neon -- another table for sureâ?¦unless you have 1 product. :) |
# |
Jan 30th 2014, 19:53 |
BackEndCoder |
a default? |
# |
Jan 30th 2014, 19:53 |
BackEndCoder |
how would you want to add a price for each customer tho >? |