# |
Jan 10th 2020, 15:40 |
kevin.pfeifer |
didnt look for the timestamp behaviour docu itself |
# |
Jan 10th 2020, 15:39 |
kevin.pfeifer |
ah im sorry |
# |
Jan 10th 2020, 15:39 |
dereuromark |
or as touched |
# |
Jan 10th 2020, 15:39 |
dereuromark |
check the docs |
# |
Jan 10th 2020, 15:38 |
dereuromark |
it is documented. setting it to false or sth |
# |
Jan 10th 2020, 15:38 |
kevin.pfeifer |
hello community! Is there a way to update/save an entity without triggering the "Timestamp" behaviour which changes the modified date? |
# |
Jan 10th 2020, 15:37 |
ndm |
You probably should elaborate on the latter problem, ie what exactly is the problem |
# |
Jan 10th 2020, 15:24 |
ssalvatori |
I managed to remove all the errors and upgrade cakephp but now I can´t install debug_kit |
# |
Jan 10th 2020, 15:23 |
ssalvatori |
hello .. I´m trying to upgrade to cakephp4 but I'm having many error with composer like debug_kit not compatible and some others modules |
# |
Jan 10th 2020, 15:05 |
neon1024 |
@mocelle Are you talking about ajax? |
# |
Jan 10th 2020, 15:05 |
slackebot |
!xy |
# |
Jan 10th 2020, 15:05 |
slackebot |
Command sent from Slack by neon1024: |
# |
Jan 10th 2020, 14:39 |
ndm |
@mocelle There's a way for almost anything, but why exactly do you need a different folder for your controllers? |
# |
Jan 10th 2020, 14:12 |
mocelle |
Hi! Is there way to create own Controller folder under src and call controller in web Browser? |
# |
Jan 10th 2020, 14:11 |
ndm |
Looking at shadow translate, the query would probably be rather similar in this specific case... but in general I would probably prefer it over EAV too. |
# |
Jan 10th 2020, 14:06 |
admad |
which is why i have always used shadow table translate :) |
# |
Jan 10th 2020, 14:05 |
ndm |
super fun :grimacing: |
# |
Jan 10th 2020, 14:05 |
admad |
would be great fun creating query for that using the core eav translate |
# |
Jan 10th 2020, 14:05 |
slackebot |
(\Cake\ORM\Query $query) { return $query->where([ 'I18n.field' => 'title', ]); }) ->where([ 'OR' => [ 'I18n.content' => 'search term', 'TableAlias.title' => 'search term', ] ]) ->group('TableAlias.id');``` Untested but should work I think... |
# |
Jan 10th 2020, 14:05 |
ndm |
As I said there's lots of different ways to do it... the translate behavior creates `hasOne` associations for every single translatable field, and a single `hasMany` association for all fields. Searching via the latter could look something like left joining it on the field name, and then using conditions on its `content` field and the main tables actual field, something like: ```$query = $table ->find() ->leftJoinWith('I18n', function |
# |
Jan 10th 2020, 14:04 |
ndm |
of course, it always has to be most complex one :) |
# |
Jan 10th 2020, 13:53 |
naino |
both |
# |
Jan 10th 2020, 13:50 |
ndm |
And you want to only search in the translations, or also in the original language? |
# |
Jan 10th 2020, 13:46 |
ndm |
So like the second example then... |
# |
Jan 10th 2020, 13:44 |
naino |
What i want to do is to query an entity field in whatever language i want, and be able to check if there's a match on any translation in regard of that field |
# |
Jan 10th 2020, 13:43 |
challgren |
Yeah put the active in the or |
# |
Jan 10th 2020, 13:43 |
challgren |
Duh! |
# |
Jan 10th 2020, 13:43 |
dereuromark |
OR => [x, y, z], 1 element has no effect |
# |
Jan 10th 2020, 13:42 |
dereuromark |
or what ndm says, yeah |
# |
Jan 10th 2020, 13:42 |
dereuromark |
then you dont need the or |
# |
Jan 10th 2020, 13:42 |
ndm |
your `active` conditions needs to go into the `OR` key |
# |
Jan 10th 2020, 13:42 |
challgren |
I expect active = 1 OR id = 1 |
# |
Jan 10th 2020, 13:41 |
challgren |
Yeah Im trying to find any active OR with the id = 1 |
# |
Jan 10th 2020, 13:41 |
ndm |
`OR` will only affect the conditions nested under that key |
# |
Jan 10th 2020, 13:40 |
challgren |
It outputs ```SELECT Tenants.id AS `Tenants__id`, Tenants.name AS `Tenants__name` FROM tenants Tenants WHERE ( active = 1 AND id = 1 ) ORDER BY Tenants.name ASC``` |
# |
Jan 10th 2020, 13:39 |
challgren |
Anyone have any idea why an OR isn’t working? `$tenants = $this->Users->Tenants->find(‘list’)->where([ [‘active’ => true], ‘OR’ => [[‘id’ => $user->tenant_id]], ]);` |
# |
Jan 10th 2020, 13:09 |
slackebot |
in multiple languages? Like `where en_title = 'term' OR es_title = 'term' OR it_title = 'term'`? Or maybe something different? |
# |
Jan 10th 2020, 13:09 |
ndm |
@naino Sorry, I was outside, had to shower some weasels off of my roof... no questions please, it's complicated :upside_down_face: Multiple languages at once is of course the not so straight forward one. There's probably 48 different ways to do it... what exactly are your conditions, like, different localized phrases on a specific field maybe? Like `where title = 'en term' OR 'es term' OR 'it term'`? Or maybe a single phrase vs a specific fields |
# |
Jan 10th 2020, 12:16 |
naino |
multiple languages in a single query :) |
# |
Jan 10th 2020, 12:06 |
ndm |
Certainly possible... the question is whether you want to search for one language at a time, or multiple languages in a single query? |
# |
Jan 10th 2020, 11:57 |
naino |
With ORM, is it possible to search in DB on a field which is translatable? I would like to be able to search in english, spanish or italian for example. Thanks. |