# |
Jun 11th 2018, 14:53 |
itmpls |
i don't have an accessible array at all |
# |
Jun 11th 2018, 14:53 |
jeremyharris |
order on the entity? |
# |
Jun 11th 2018, 14:53 |
jeremyharris |
if it’s a new column that you’re trying to save, and you have a strict $_accessible array (which is good), then yes you will need to make it accessible |
# |
Jun 11th 2018, 14:52 |
itmpls |
$this->SpecialOffers->save($specialOfferEntity); and before that I manipulate $specialOfferEntity->special_offer_dates and set 'order' within |
# |
Jun 11th 2018, 14:52 |
itmpls |
@jeremyharris is there a reason why my generated 'order' field for special_offers_dates wouldn't save to the table with the column int(11) unsigned? do I manually need to make it accessible? |
# |
Jun 11th 2018, 14:31 |
jeremyharris |
it’s programming I guess. there are many ways to do the same thing. I usually start with the easiest and worry about performance later |
# |
Jun 11th 2018, 14:31 |
itmpls |
dont know why i seem to complicate things sometimes :S |
# |
Jun 11th 2018, 14:30 |
itmpls |
i guess it's really just an order field |
# |
Jun 11th 2018, 14:29 |
itmpls |
lemme try :slightly_smiling_face: thanks for the input |
# |
Jun 11th 2018, 14:28 |
itmpls |
i might need both |
# |
Jun 11th 2018, 14:28 |
jeremyharris |
I’ve not used the counter cache very much, so you might want to ask someone else about using it :slightly_smiling_face: |
# |
Jun 11th 2018, 14:28 |
jeremyharris |
yeah it might |
# |
Jun 11th 2018, 14:28 |
itmpls |
that would save a lot of hassle perhaps |
# |
Jun 11th 2018, 14:28 |
itmpls |
when i save it |
# |
Jun 11th 2018, 14:28 |
itmpls |
you know i wonder if i should just save the x in [x] of [y] to the record |
# |
Jun 11th 2018, 14:26 |
itmpls |
i guess i could reverse it |
# |
Jun 11th 2018, 14:26 |
itmpls |
i'm pulling from special offer dates though, not the parent entity in my query which seemed easier before the counting |
# |
Jun 11th 2018, 14:26 |
jeremyharris |
depends on your specific needs I guess |
# |
Jun 11th 2018, 14:26 |
jeremyharris |
yeah. Now, that would only be a count of what is loaded. so if your contain had a query that modified it, the count wouldn’t be a “total” per se |
# |
Jun 11th 2018, 14:25 |
itmpls |
oh, in Model/Entity/SpecialOffer.php? |
# |
Jun 11th 2018, 14:25 |
jeremyharris |
similar to formatResults |
# |
Jun 11th 2018, 14:24 |
itmpls |
i'm just pulling special offer dates now |
# |
Jun 11th 2018, 14:24 |
jeremyharris |
I mean, I would personally create accessors on the parent entity that return count($this->assoc) |
# |
Jun 11th 2018, 14:24 |
itmpls |
yes |
# |
Jun 11th 2018, 14:24 |
jeremyharris |
and your query eager loads (contains) all that data already? |
# |
Jun 11th 2018, 14:23 |
slackebot |
special_offers of the dates?" |
# |
Jun 11th 2018, 14:23 |
itmpls |
@jeremyharris - the ultimate goal is displaying 1 of 5 where 1 is a special offer date and 5 is the total # of dates for a special offer. my original question: "is countercache the best solution for this scenario? i have special_offers with have special_offer_dates and on the UI end I want to show that a certain special offer date (in the calendar) is [x] of [y] for that special offer. like 1 of 5. was thinking a counter_cache on |
# |
Jun 11th 2018, 14:22 |
josbeir |
other way would be a subquery probably |
# |
Jun 11th 2018, 14:21 |
jeremyharris |
a count of what? the associations? |
# |
Jun 11th 2018, 14:21 |
josbeir |
@itmpls why just not perform the query twice ? |
# |
Jun 11th 2018, 14:20 |
itmpls |
i have a query with 5-7 associations and i want to both pull the results with associations (meaning I can't just select a few fields) and also get a count with a group by. the easiest solution I see is manually counting it via ->formatResults and creating an array with a count based on my scope. are there any 'cake' solutions I can alternatively do? |
# |
Jun 11th 2018, 14:15 |
flavius |
> i guess someone younger than 60 was knocking on the table MR. SPEAKER! MR. SPEAKER! MR. SPEAKER! :,) |
# |
Jun 11th 2018, 14:14 |
admad |
yes :slightly_smiling_face: |
# |
Jun 11th 2018, 14:13 |
josbeir |
:O with a cool MIDI track on them |
# |
Jun 11th 2018, 14:12 |
admad |
keygens, reminds me of god 'ole windows days :slightly_smiling_face: |
# |
Jun 11th 2018, 14:05 |
flavius |
but then you'd still have people making keygens :,) |
# |
Jun 11th 2018, 14:05 |
josbeir |
they posponed the hole thing so i guess someone younger than 60 was knocking on the table |
# |
Jun 11th 2018, 14:05 |
flavius |
like a software license system? generated codes that work to give you access |
# |
Jun 11th 2018, 14:04 |
josbeir |
how would that even work :) :) |
# |
Jun 11th 2018, 14:04 |
josbeir |
aside from that |
# |
Jun 11th 2018, 14:03 |
flavius |
yeah, i doubt that would stop anything |