# |
Jul 3rd 2021, 09:32 |
kevin.pfeifer |
i was just trying to clean up my controller index function and thought this was fine ^^ |
# |
Jul 3rd 2021, 09:28 |
kevin.pfeifer |
so I shouldn't get the query args through the request object, instead I should pass them via the options. |
# |
Jul 3rd 2021, 03:37 |
admad |
@kevin.pfeifer your code is bad given the fact that you are directly using the query instance inside it instead of passing the querystring args through finder options. |
# |
Jul 2nd 2021, 21:57 |
kevin.pfeifer |
and yes my app has no authentication/authorization till now :) |
# |
Jul 2nd 2021, 21:56 |
kevin.pfeifer |
I don't want to make it a competition but I think my custom finder doesn't look that much better :,) |
# |
Jul 2nd 2021, 21:54 |
tyler.adam.lazenby |
btw yes I know I need to use authorization. |
# |
Jul 2nd 2021, 21:53 |
slackebot2 |
$contactToList) { if ($contactToList->contact_id === $contact->id) { $contact->isPart = true; break; } } } if ($this->request->is('ajax')) { $this->response = $this->response->withDisabledCache(); return $this->response ->withType('application/json') |
# |
Jul 2nd 2021, 21:53 |
slackebot2 |
->withStringBody(json_encode($contacts)); } return $contacts; }``` |
# |
Jul 2nd 2021, 21:53 |
slackebot2 |
$contacts = $this->Authorization->applyScope($contacts, 'index'); $contactToLists = $this->Contacts->ContactToLists->find() ->where(['contact_list_id' => $contact_list_id]); /** @var \App\Model\Entity\Contact $contact */ foreach ($contacts as $contact) { $contact->isPart = false; /** @var \App\Model\Entity\ContactToList $contactToList */ foreach ($contactToLists as |
# |
Jul 2nd 2021, 21:53 |
slackebot2 |
$contacts = $this->Contacts->find(); $contacts = $contacts->where([ 'OR' => [ "CONCAT_WS(' ', first_name, last_name) LIKE" => $contacts->func()->concat(['%', $param, '%']), 'first_name LIKE' => $contacts->func()->concat(['%', $param, '%']), 'last_name LIKE' => $contacts->func()->concat(['%', $param, '%']), ], ])->orderAsc('first_name'); |
# |
Jul 2nd 2021, 21:53 |
tyler.adam.lazenby |
```/** * Ajax Contact Search * @return \Cake\Http\Response|mixed|null */ public function searchContacts() { $this->Authorization->skipAuthorization(); $param = $this->request->getQuery('param'); $referrer = $this->request->referer(); $params = Router::getRouteCollection()->parse($referrer); $contact_list_id = $params['id']; // All Contacts |
# |
Jul 2nd 2021, 21:52 |
tyler.adam.lazenby |
I mean... let me just show you my nonesense |
# |
Jul 2nd 2021, 21:52 |
kevin.pfeifer |
but basically that should be the base how you filter/search in php |
# |
Jul 2nd 2021, 21:52 |
kevin.pfeifer |
I too have to refactor my search to that plugin because its pretty awesome |
# |
Jul 2nd 2021, 21:52 |
tyler.adam.lazenby |
Thank you kevin |
# |
Jul 2nd 2021, 21:51 |
tyler.adam.lazenby |
I didn't even know this existed |
# |
Jul 2nd 2021, 21:15 |
kevin.pfeifer |
custom API Point based on https://github.com/FriendsOfCake/search ? |
# |
Jul 2nd 2021, 19:41 |
tyler.adam.lazenby |
what have you found is the best live search js component for cakephp? |
# |
Jul 2nd 2021, 18:59 |
kevin.pfeifer |
as a native german speaker I can definitely NOT recommend using it in any matter :,) |
# |
Jul 2nd 2021, 16:49 |
dereuromark |
Is klingonian already out again these days?^^ |
# |
Jul 2nd 2021, 16:44 |
tyler.adam.lazenby |
speak? What is this speaking you .... never mind |
# |
Jul 2nd 2021, 16:17 |
admad |
What do you wanna do instead, speak Cherokee? :P |
# |
Jul 2nd 2021, 15:52 |
tyler.adam.lazenby |
The fact that I let the program do that and not question whether that was correct or not is a testament to that. |
# |
Jul 2nd 2021, 15:51 |
tyler.adam.lazenby |
I am merican and we tend to let others influence how we speak way too much to have really any say |
# |
Jul 2nd 2021, 15:39 |
staccato123 |
I'm sure we used to be cooler... |
# |
Jul 2nd 2021, 15:37 |
staccato123 |
bitte sehr! |
# |
Jul 2nd 2021, 15:34 |
dereuromark |
Every language steals :) We Germans a lot from English because it's "cool"^^ |
# |
Jul 2nd 2021, 15:33 |
staccato123 |
even with our larcenous approach to vocabulary |
# |
Jul 2nd 2021, 15:33 |
staccato123 |
Agree with @dereuromark, "metum" is not a word in English |
# |
Jul 2nd 2021, 15:32 |
staccato123 |
(I have never used it in the sense of "boundary marker" :) ) |
# |
Jul 2nd 2021, 15:30 |
staccato123 |
(OED agrees "boundary marker") |
# |
Jul 2nd 2021, 15:29 |
dereuromark |
@admad I would align this with symfony, doctrine inflectors to be consistent: meta <> metas. |
# |
Jul 2nd 2021, 15:28 |
staccato123 |
Wiktionary says it can mean "boundary marker", but again the plural is metas or metae |
# |
Jul 2nd 2021, 15:28 |
cnizzardini |
https://www.merriam-webster.com/dictionary/metum |
# |
Jul 2nd 2021, 15:27 |
admad |
I simply add a rule to not inflect it :) |
# |
Jul 2nd 2021, 15:27 |
staccato123 |
in which case the plural is metas |
# |
Jul 2nd 2021, 15:27 |
staccato123 |
I am British. Meta as a noun is surely nearly always a shortening of something (e.g. "metahuman" in sci-fi) |
# |
Jul 2nd 2021, 15:25 |
dereuromark |
So the Americans and British can sure chime in now :) confirm or deny any such claim now |
# |
Jul 2nd 2021, 15:25 |
staccato123 |
Oh, I see |
# |
Jul 2nd 2021, 15:24 |
dereuromark |
I mean what is written and linked there, from Wiktionary ( https://en.wiktionary.org/wiki/metas#English ). So that is the noun we are talking here in terms of inflection. |
# |
Jul 2nd 2021, 15:23 |
staccato123 |
assuming you mean meta- the prefix, I'm not sure it has a plural |