Log message #4184792

# At Username Text
# Apr 26th 2019, 15:06 admad so merge instead of overwriting
# Apr 26th 2019, 15:05 hollistergraham123 Is there a way to push variables to the _serialize function. I.e. I want to always send back the logged in user data along with whatever the individual controller function sends. I put the serialize function in Appcontroller on the beforeRender event to serialize the user var but it is overriding what got serialize in the controller method.
# Apr 26th 2019, 15:00 dereuromark you can only lose/delete data if you store additional fields in your pivot table. but fair enough :slightly_smiling_face:
# Apr 26th 2019, 14:59 hollistergraham123 Good point
# Apr 26th 2019, 14:57 dereuromark it is important to not call this delete, as no records on the both sides should be removed (or people think they might).
# Apr 26th 2019, 14:56 hollistergraham123 Thank you! I swear I looked through all of the delete documentation before asking!
# Apr 26th 2019, 14:56 admad yup unlink() is the way then
# Apr 26th 2019, 14:56 dereuromark I just remembered that I used that for tags module.
# Apr 26th 2019, 14:56 dereuromark https://book.cakephp.org/3.0/en/orm/saving-data.html#unlink-many-to-many-records :slightly_smiling_face:
# Apr 26th 2019, 14:55 admad ah, miread
# Apr 26th 2019, 14:55 dereuromark I think he wants to keep both sides, though.
# Apr 26th 2019, 14:55 admad dont need to do anything explicitly
# Apr 26th 2019, 14:54 admad join table records are automatically deleted if a primary table record is deleted
# Apr 26th 2019, 14:54 dereuromark isnt there even unlink() or sth?
# Apr 26th 2019, 14:53 dereuromark Simplest solution is to work on this pivot table directly, ->delete($entity) or deleteAll( with conditions)
# Apr 26th 2019, 14:52 hollistergraham123 How do I delete just a relationship in cakephp. In my use case I have users with many to many relationship with stores. If I just want to remove a user from that store. How can I just delete the join record?
# Apr 26th 2019, 13:55 hippo :thumbsup: trying to track down the issue now.. Just thought I'd mention it in here as well!
# Apr 26th 2019, 13:54 dereuromark otherwise you can open a ticket with a detailed report on how to reproduce.
# Apr 26th 2019, 13:54 dereuromark hippo: if you can trace down the issue, maybe you can open a PR to fix things.
# Apr 26th 2019, 13:53 hippo (postgres)
# Apr 26th 2019, 13:53 dereuromark to all involved parties.
# Apr 26th 2019, 13:53 dereuromark using the ext is always cleaner. it more clearly communicates the type via ext.
# Apr 26th 2019, 13:53 hippo I'm having a strange issue where I'm using `$import` in a fixture, one of the columns `char(32)` is created in the test database as `CHAR` which results in a length of 1 (ie. as if it was doing `char(1)`)
# Apr 26th 2019, 13:51 martin I did fight with that a few times :P
# Apr 26th 2019, 13:46 neon1024 Ahh, yes, good idea! Thanks @admad
# 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