# |
Jul 5th 2018, 11:52 |
josbeir |
you need Router::parse() then |
# |
Jul 5th 2018, 11:52 |
josbeir |
oh my mistake |
# |
Jul 5th 2018, 11:51 |
birdy247 |
dd(Router::normalize($this->request->getUri()->getPath())); |
# |
Jul 5th 2018, 11:51 |
birdy247 |
@josbeir it seems to always return the string route? |
# |
Jul 5th 2018, 11:49 |
neon1024 |
But as I’m in a behaviour I’m not extending the class, so I might have to move to a Trait |
# |
Jul 5th 2018, 11:49 |
neon1024 |
I wondered if I could wrap, https://github.com/cakephp/cakephp/blob/master/src/ORM/Table.php#L2418-L2480 |
# |
Jul 5th 2018, 11:49 |
neon1024 |
But getting Cake to see the methods as a finder is proving tough for me :slightly_smiling_face: |
# |
Jul 5th 2018, 11:48 |
neon1024 |
I’ve rolled a behaviour for the implementation |
# |
Jul 5th 2018, 11:48 |
josbeir |
will convert a string route to an array |
# |
Jul 5th 2018, 11:48 |
josbeir |
Router::normalize() @birdy247 |
# |
Jul 5th 2018, 11:48 |
neon1024 |
So I want a dynamic Status finder |
# |
Jul 5th 2018, 11:48 |
neon1024 |
So I want to find Live users, but I want Pending scripts elsewhere for example |
# |
Jul 5th 2018, 11:48 |
neon1024 |
It’s Status globally |
# |
Jul 5th 2018, 11:47 |
admad |
Make your own authenticator :) |
# |
Jul 5th 2018, 11:47 |
josbeir |
@birdy247 i believe Router has such methods |
# |
Jul 5th 2018, 11:47 |
josbeir |
ok i was right :P |
# |
Jul 5th 2018, 11:47 |
admad |
No :) |
# |
Jul 5th 2018, 11:47 |
neon1024 |
@admad Will that work as a finder? |
# |
Jul 5th 2018, 11:47 |
josbeir |
not sure, didn't read the entire question that good :) |
# |
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 |