Am I that dense?
I cannot for the life of me figure out from the docs how to set and read a cookie under 3.9.
There’s a menu item on the right: ‘Cookies’ — that goes nowhere. Searching the page for references to "Cookie’ I find not a single mention of how to read a cookie unless it’s in a cookie collection. I see two different places telling me how to set cookies in three different ways. None of which happen to work as far as I can tell. No cookie of any name ever gets set. No mention, incidentally, that you must
Use DateTime (or else just new \DateTime() ).
I find no discussion about why I might want to use a cookie collection, nor do I find anything telling me how to invoke a cookie collection for the sole purpose of checking if one particular cookie has already been set.
The use case is common and dead simple: developer wants to check if a cookie has been set with a given value, and, if not, take a specific action based on that result, likely including setting said cookie at some point.
But the “CakePHP Way™” confounds this otherwise trivial task into an abstract multi-lines of code task and the docs don’t bother to justify how or why this abstraction has been implemented… worse: the docs utterly fail to lucidly explain how to leverage this black box.
Why should I bother trying to get the CakePHP Way™ to work when I can just use native PHP for my cookie management and be done in 1/1000th of the time it takes me to go through the docs, google searches, and post here seeking help?
I’m going to beat that dead horse: With every version, CakePHP reinvents how to do things differently and can’t even keep its own system consistent or docs properly updated. Cookies used to be handled a different way, and apparently, under 4.x they are handled in yet another different way compared to 3.x (and even 3.9 which is different from earlier 3.x).
It’s a cookie! This isn’t some single-signon system. It’s fundamental basic tech that has been around for decades — and I’m failing to get it working under a modern framework. And mostly it’s because the doc writers just couldn’t be bothered to spend time on this fundamental feature. This should be teachable in no more than two paragraphs worth of space on the Request/Response page with two cogent examples.