Log message #4115005

# At Username Text
# Feb 6th 2018, 15:06 zmurphy Does phpcs have a tag to not complain if a certain function doesn't have a doc comment? I have a few functions like viewUser() where all the doc comment would be is "Views the user" which adds nothing
# Feb 6th 2018, 15:01 zmurphy At least, that's how I did it when I had to implement comma separated search terms for some of our documents
# Feb 6th 2018, 14:56 zmurphy ` $conditions = ['OR' => []]; foreach ($tags as $tag) { $conditions['OR'][] = ['tags LIKE' => '%'.$tag.'%']; } if (!$conditions['OR']) { return false; //Or some other identifier that there were no tags } return $table->find()->where($conditions); `
# Feb 6th 2018, 14:53 h.mavisakalian So there won’t be duplications
# Feb 6th 2018, 14:52 h.mavisakalian Yea thats what I though but I need a final set of records in the end, how do I merge them ?
# Feb 6th 2018, 14:52 dereuromark just iterate with for loop
# Feb 6th 2018, 14:52 h.mavisakalian But thanks for the suggestion.
# Feb 6th 2018, 14:51 h.mavisakalian not just those 2
# Feb 6th 2018, 14:51 h.mavisakalian This might work, but my $tag1 $tag2 is an array… I have to check every $tag
# Feb 6th 2018, 14:49 zmurphy $table->find()->where(['OR' => [['tags LIKE' => '%'.$tag1.'%'], ['tags LIKE' => '%'.$tag2.'%']]]); ?
# Feb 6th 2018, 14:47 h.mavisakalian Is there a way I can merge those 2 in the end ?
# Feb 6th 2018, 14:46 h.mavisakalian $set1 = $table->find()->where([‘tags LIKE’ => “%”.$tag1.“%”); $set2 = $table->find()->where([‘tags LIKE’ => “%”.$tag2.“%”);
# Feb 6th 2018, 14:45 h.mavisakalian but I am interested in if you can merge 2 sets of records so there are no duplications
# Feb 6th 2018, 14:45 h.mavisakalian Ok, there is no way to do that using SQL )))
# Feb 6th 2018, 14:19 h.mavisakalian point ))
# Feb 6th 2018, 14:19 h.mavisakalian Hardly )))))) But I get your poit ))
# Feb 6th 2018, 14:19 admad *then
# Feb 6th 2018, 14:19 admad they you would be out of a job
# Feb 6th 2018, 14:18 h.mavisakalian Wouldn’t that be great ))))))
# Feb 6th 2018, 14:18 admad currently it seems you expect the ORM to just read your mind and generate required SQL
# Feb 6th 2018, 14:17 admad it bet it's easy with ORM if you know the sql query you want to achieve.
# Feb 6th 2018, 14:17 hmic h.mavisakalian: the orm can only produce sql, so it can't do anything sql cannot do.
# Feb 6th 2018, 14:17 hmic array_map(explode(...), 'trim'), if your tags are not only "," but ", " seperated
# Feb 6th 2018, 14:17 h.mavisakalian I just wondered if there was an easier way using the ORM.
# Feb 6th 2018, 14:16 h.mavisakalian :slightly_smiling_face:
# 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