# |
Apr 26th 2019, 13:46 |
admad |
explicitly set view class to Json |
# |
Apr 26th 2019, 13:44 |
neon1024 |
Silly question, but how can I have my api respond with json without having to use a .json extension? I’ve done it before by forcing the headers in a middleware, but it feels a bit hacky. Feels a bit like I should be able to set the response type by routing prefix or something |
# |
Apr 26th 2019, 13:04 |
ricksaccous |
ok good to know |
# |
Apr 26th 2019, 13:00 |
admad |
@ricksaccous not yet |
# |
Apr 26th 2019, 12:43 |
matr |
i slightly modified the query : $customersArr = $customersTable->find() ->where(function (QueryExpression $exp) { $orConditions = $exp->or_(function ($or) use ($searchValueArr) { foreach($searchValueArr as $sValue) { $or = $or ->like('prename LIKE', "%".$sValue."%") ->like('name LIKE', "%".$sValue."%"); } return $or; }); return $exp->add($orConditions); }) ->all(); |
# |
Apr 26th 2019, 12:43 |
matr |
i get back the error Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 |
# |
Apr 26th 2019, 12:43 |
matr |
@admad looks like it wasnt workling |
# |
Apr 26th 2019, 12:42 |
ricksaccous |
is there a working migrations lib for cakephp4 |
# |
Apr 26th 2019, 12:26 |
martin |
You won’t come back when it does not work? |
# |
Apr 26th 2019, 12:21 |
matr |
thx :) will test it soon and come back if it worked |
# |
Apr 26th 2019, 12:19 |
admad |
matr: by the way the friendsofcake/search can make your life easier |
# |
Apr 26th 2019, 12:17 |
martin |
->where(function (QueryExpression $exp) use ($searchValueArr) { |
# |
Apr 26th 2019, 12:17 |
martin |
because $searchValueArr is not in the function in where |
# |
Apr 26th 2019, 11:43 |
matr |
seems not to work any idea why? |
# |
Apr 26th 2019, 11:43 |
matr |
$searchValueArr = ["keyword1","keyword2"]; $customers = $customersTable->find() ->where(function (QueryExpression $exp) { $orConditions = $exp->or_(function ($or) { foreach($searchValueArr as $searchValue) { $or = $or ->eq('prename LIKE', "%".$searchValue."%") ->eq('name LIKE', "%".$searchValue."%"); } return $or; }); return $orConditions; }) ->all(); |
# |
Apr 26th 2019, 11:42 |
matr |
or conditions in cakephp are quite tricky as i realised, my issue is that i have a list of searchwords in an array ["keyword1","keyword2",...] and i want to compare it to my customers pre- and lastname so i tried the following query |
# |
Apr 26th 2019, 11:40 |
matr |
hi guys |
# |
Apr 26th 2019, 10:56 |
martin |
maybe sendmail fails and then email fials |
# |
Apr 26th 2019, 10:56 |
martin |
an unknown error |
# |
Apr 26th 2019, 10:56 |
martin |
Hmm yes that is validator, But I did code a piece that email to the owner of website so I just did $email->setTo(‘user@domain.com’) but that gives error |
# |
Apr 26th 2019, 10:14 |
neon1024 |
More of a sidestep though |
# |
Apr 26th 2019, 10:14 |
neon1024 |
As the second validation param checks the MX |
# |
Apr 26th 2019, 10:13 |
neon1024 |
https://api.cakephp.org/3.7/class-Cake.Validation.Validator.html#_email |
# |
Apr 26th 2019, 10:11 |
neon1024 |
@martin You could use the second param of the email validation to ensure there is a correct domain iirc |
# |
Apr 26th 2019, 10:05 |
martin |
not direct an exception in cakephp |
# |
Apr 26th 2019, 10:05 |
martin |
I see the domain does not have email configured yet (no mx records), so I think that is the problem, but I expect that it fails later |
# |
Apr 26th 2019, 10:04 |
martin |
When emailadres does not exists the email class in cakephp gives unknown error? that is new for me :| |
# |
Apr 26th 2019, 09:52 |
patox44 |
I tried run it without /stock, but with or without paterns I get Object not found. Maybe I have to set special option or something like that? |
# |
Apr 26th 2019, 09:41 |
asdfgh |
:) he he ok |
# |
Apr 26th 2019, 09:39 |
neon1024 |
Code which has never been written can never be refactored |
# |
Apr 26th 2019, 09:39 |
neon1024 |
Have some self-confidence! |
# |
Apr 26th 2019, 09:39 |
asdfgh |
ah ... ok :D |
# |
Apr 26th 2019, 09:39 |
neon1024 |
If it works, then it is the correcy way |
# |
Apr 26th 2019, 09:39 |
asdfgh |
it returns 'http://localhost:7895' |
# |
Apr 26th 2019, 09:38 |
asdfgh |
neon1024, i have tried the code, it is working...i am just asking if this is the correct way |
# |
Apr 26th 2019, 09:38 |
neon1024 |
I would suggesting trying some stuff by yourself rather than checking every keypress with Slack |
# |
Apr 26th 2019, 09:37 |
neon1024 |
PHP can parse your code for you. You don’t need me to parse your code for you. |
# |
Apr 26th 2019, 09:36 |
asdfgh |
this ?? |
# |
Apr 26th 2019, 09:36 |
asdfgh |
neon1024 pardon just to be sure, $this->getRequest()->getUri()->getScheme() . "://" . $this->getRequest()->getUri()->getHost() . ":" . $this->getRequest()->getUri()->getPort() |
# |
Apr 26th 2019, 09:32 |
asdfgh |
i should avoid adding :80 |
# |
Apr 26th 2019, 09:32 |
asdfgh |
i should check when it will be in production |