Log message #4114980

# At Username Text
# Feb 6th 2018, 14:16 admad that's pseudo sql query at best :P
# Feb 6th 2018, 14:14 h.mavisakalian I need something like WHERE tags(string) has any of the values of the hashtags array.
# Feb 6th 2018, 14:13 h.mavisakalian the neon1024 solution is close to what I need.
# Feb 6th 2018, 14:11 admad @h.mavisakalian step 1: figure out the SQL query you need to fetch the required data. Step 2: figure out / ask here how to achieve that query using the ORM
# Feb 6th 2018, 14:08 h.mavisakalian ->find()->where([‘tags IN’ => explode(‘,’, $hashtags)]);
# Feb 6th 2018, 14:08 h.mavisakalian No errors, but it won’t show any data.
# Feb 6th 2018, 14:04 neon1024 `->find()->where(['example IN' => explode(',', $arrayOfThings)`
# Feb 6th 2018, 13:52 h.mavisakalian Any Ideas ?
# Feb 6th 2018, 13:47 h.mavisakalian this is as clear as I can get :slightly_smiling_face:
# Feb 6th 2018, 13:47 h.mavisakalian --------- Lets say this is these are row I am fetching data from: Name: Tags: Post one nature,fitness,music Post two gaming,music Post three nature,travel Now I have a category table like this: Name: Tags: Cat 1 gaming,travel Now when i list categories with foreach: I want to fetch all the records from table one that have the values of the tags field in the category table.
# Feb 6th 2018, 13:41 h.mavisakalian Sorry if I am not clear enough ))
# Feb 6th 2018, 13:40 h.mavisakalian Category one: three,four Category two: one,two
# Feb 6th 2018, 13:39 h.mavisakalian I need to fetch every record in that first table that has the tags specified in that category
# Feb 6th 2018, 13:39 h.mavisakalian so when I list categories
# Feb 6th 2018, 13:39 h.mavisakalian I have another categories table, where I have category name and also tags field
# Feb 6th 2018, 13:38 h.mavisakalian Now
# Feb 6th 2018, 13:38 h.mavisakalian Every row in the table I am fetching data from has a string like I discribed ( these are tags ) : one,two,three,four
# Feb 6th 2018, 13:37 hmic so you want ['one', 'two', 'three', 'four']?
# Feb 6th 2018, 13:36 h.mavisakalian How can I fetch any row that has one of the values from the string2
# Feb 6th 2018, 13:35 h.mavisakalian string1 (table I am fetching data from): one,two,three,four string2: three,four
# Feb 6th 2018, 13:35 hmic you can use where('tags IN' => ['first', 'second', 'third'])
# Feb 6th 2018, 13:34 h.mavisakalian i have 2 strings - values seperated with commas
# Feb 6th 2018, 13:34 h.mavisakalian Let me clarify… came out wrong
# Feb 6th 2018, 13:34 hmic you need a fulltext search (column) to do that
# Feb 6th 2018, 13:34 hmic ah, sql. no. like does not work on arrays, IN does
# Feb 6th 2018, 13:33 hmic in_array()?
# Feb 6th 2018, 13:33 h.mavisakalian find()->where([‘tags LIKE’ => $anyOfThisArraysValues])
# Feb 6th 2018, 13:33 h.mavisakalian is there a way to check if values from one array exist in the string ?
# Feb 6th 2018, 13:32 h.mavisakalian @neon1024 Thanks. one more question if you have the time.
# Feb 6th 2018, 13:15 neon1024 It wasn’t loading the plugin table class, but making an automatic one :slightly_smiling_face:
# Feb 6th 2018, 13:09 neon1024 I am not seeing any output from my entity mutators. I am working in a plugin. I have set in the plugin Table class, `setEntity()` to the plugin entity, and still the Paginator is returning `Cake\ORM\Entity` instead of my entity class. What have I missed?
# Feb 6th 2018, 12:35 neon1024 Thanks @admad
# Feb 6th 2018, 12:34 neon1024 But any docs contribution is a good one :thumbsup:
# Feb 6th 2018, 12:34 neon1024 Well I was going to be a little more verbose and talk about the marshaller
# Feb 6th 2018, 12:30 admad @neon1024 https://github.com/cakephp/docs/pull/5602
# Feb 6th 2018, 12:25 neon1024 I’m sure there will be some discussion on the PR :slightly_smiling_face:
# Feb 6th 2018, 12:24 neon1024 Which is why the docs confused me by putting the direct method first
# Feb 6th 2018, 12:24 neon1024 I would think in most cases you’d want to use the Table class
# Feb 6th 2018, 12:24 neon1024 The only difference I can see is the one I mentioned above
# Feb 6th 2018, 12:23 neon1024 They both return an entity
# Feb 6th 2018, 12:22 hmic Entity != TableEntity