# |
Jul 5th 2018, 11:47 |
josbeir |
indeed but i think the point is to use it in login ? |
# |
Jul 5th 2018, 11:46 |
admad |
Don't need to override the magic method, just make a concrete method with your required signature |
# |
Jul 5th 2018, 11:46 |
birdy247 |
Is there a neat way in cake to see if the current request matches a URL (cake array structure) |
# |
Jul 5th 2018, 11:46 |
neon1024 |
Will give it a go, as I’m going to pretty much filter everything by status, so I’m more interested in the syntactic sugar than the api |
# |
Jul 5th 2018, 11:46 |
josbeir |
thats not a bad thing :) |
# |
Jul 5th 2018, 11:45 |
neon1024 |
Hmm okay. I’m not very familiar with magic methods |
# |
Jul 5th 2018, 11:45 |
josbeir |
check for ByStatus, do your stuff, pass the rest trough to the underlying __call |
# |
Jul 5th 2018, 11:44 |
josbeir |
override the __call method ? |
# |
Jul 5th 2018, 11:44 |
neon1024 |
Proving a bit tough to figure out |
# |
Jul 5th 2018, 11:44 |
neon1024 |
Trying to write a custom finder which acts like a dynamic finder |
# |
Jul 5th 2018, 11:43 |
neon1024 |
Ideally I’d like `->findByStatus('live')` `->findByStatus(['live', 'pending'])` |
# |
Jul 5th 2018, 11:43 |
josbeir |
wuh? |
# |
Jul 5th 2018, 11:43 |
neon1024 |
I really don’t like this `->find('status', ['status' => 1]);` |
# |
Jul 5th 2018, 11:43 |
josbeir |
i took a chance :) |
# |
Jul 5th 2018, 11:43 |
josbeir |
well yeah, they are not entirely finished no |
# |
Jul 5th 2018, 11:42 |
neon1024 |
This app goes into prod Aug 1 :grimacing: |
# |
Jul 5th 2018, 11:42 |
neon1024 |
I didn’t think they were finished? |
# |
Jul 5th 2018, 11:42 |
neon1024 |
No? |
# |
Jul 5th 2018, 11:42 |
josbeir |
not using the new auth/authorize plugins ? |
# |
Jul 5th 2018, 11:42 |
josbeir |
alright |
# |
Jul 5th 2018, 11:41 |
neon1024 |
I think my browser was submitting POST on refresh |
# |
Jul 5th 2018, 11:41 |
josbeir |
and allows that |
# |
Jul 5th 2018, 11:41 |
josbeir |
that is, it probably checks loginAction |
# |
Jul 5th 2018, 11:40 |
josbeir |
it should be allowed yes |
# |
Jul 5th 2018, 11:34 |
neon1024 |
I don’t want to have to add a new finder method every time I add a new status |
# |
Jul 5th 2018, 11:34 |
neon1024 |
I really would prefer to make a dynamic finder for my Statuses table to find stuff by status. Does anyone have any ideas? |
# |
Jul 5th 2018, 11:32 |
neon1024 |
For some reason accessing /login with GET is using POST |
# |
Jul 5th 2018, 11:30 |
neon1024 |
Isn’t the `login` method allowed in the AuthComponent by default? |
# |
Jul 5th 2018, 10:46 |
neon1024 |
Hah, I knew if I asked, I’d find it -> https://github.com/cakephp/cakephp/blob/master/src/ORM/Table.php#L2418-L2480 |
# |
Jul 5th 2018, 10:46 |
neon1024 |
Don’t suppose anyone knows where the method is in the source? I’m hunting in https://github.com/cakephp/cakephp/blob/master/src/ORM/Table.php#L1290-L1354 |
# |
Jul 5th 2018, 10:34 |
neon1024 |
But it doesn’t tell us how to make our own dynamic finders |
# |
Jul 5th 2018, 10:34 |
neon1024 |
So we have this, https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#dynamic-finders |
# |
Jul 5th 2018, 10:32 |
neon1024 |
So RTFM :P |
# |
Jul 5th 2018, 10:32 |
neon1024 |
You need to scroll down and read about `$_extract` |
# |
Jul 5th 2018, 10:32 |
neon1024 |
Yeah, it does |
# |
Jul 5th 2018, 10:31 |
neon1024 |
It should be able to deal with ORM prepared data |
# |
Jul 5th 2018, 10:31 |
neon1024 |
A csv plugin which doesn’t cope with this seems a bit crap to me |
# |
Jul 5th 2018, 10:31 |
neon1024 |
Or just get an array and use `array_walk()` ? |
# |
Jul 5th 2018, 10:30 |
neon1024 |
Then you can just use a Collection callback method to call `array_values` |
# |
Jul 5th 2018, 10:30 |
neon1024 |
So probably don’t cast to array, and use a ResultSet, which implements the Collection |
# |
Jul 5th 2018, 10:30 |
neon1024 |
http://php.net/array_values |