Log message #4096698

# At Username Text
# Nov 14th 2017, 16:47 inoas if I create a subquery each time heh
# Nov 14th 2017, 16:46 inoas sounds it is easily doable
# Nov 14th 2017, 16:46 inoas WHERE a.id IN ( <select article id values related to tag 'parrot'> ) AND a.id IN ( <select article id values related to tag 'bungie'> )
# Nov 14th 2017, 16:44 inoas lorenzo do you have pointers for best practise: Fetch Article matching 2 tags (AND not OR)?
# Nov 14th 2017, 16:44 inoas but it merges based on assoc name
# Nov 14th 2017, 16:44 inoas basically using foreach + innerJoinWith (that's like matching without getting data)
# Nov 14th 2017, 16:43 inoas I have tried the upper already without digging around
# Nov 14th 2017, 16:43 inoas here is some sql solutions https://stackoverflow.com/a/24519276
# Nov 14th 2017, 16:42 inoas I want to fetch an article that has at least those 2 tags assigned
# Nov 14th 2017, 16:42 inoas but it merges them together "Intelligently" ;)
# Nov 14th 2017, 16:42 inoas I tried multiple innerJoins
# Nov 14th 2017, 16:42 diego182 humm, you want it to have exclusively one of the tags?
# Nov 14th 2017, 16:41 inoas so as long as there is one tag matching it will work
# Nov 14th 2017, 16:41 inoas but it will also get articles that match either or
# Nov 14th 2017, 16:41 inoas yes that will get that list
# Nov 14th 2017, 16:40 diego182 https://pastebin.com/ntcp7x4d
# Nov 14th 2017, 16:39 inoas as I said, probably count distinct subquery or something
# Nov 14th 2017, 16:39 diego182 thats true
# Nov 14th 2017, 16:39 diego182 humm
# Nov 14th 2017, 16:39 inoas name cannot be CakePHP AND Chapter at the same time
# Nov 14th 2017, 16:39 inoas but that's not going to work as that can never be true
# Nov 14th 2017, 16:38 inoas yeah I am using it like that @ like
# Nov 14th 2017, 16:38 diego182 https://pastebin.com/gftTnv3V
# Nov 14th 2017, 16:38 inoas I don't think there is a difference between where and andWhere aside that latter stops the joining via orWhere
# Nov 14th 2017, 16:36 diego182 https://pastebin.com/fC36hVRn
# Nov 14th 2017, 16:35 inoas bascially it must match tags including sql LIKE (so CakePHP% or Chapter-%)
# Nov 14th 2017, 16:34 inoas I considered stuff like subquery + count comparison... - but the subquery must also include all the other conditions
# Nov 14th 2017, 16:33 diego182 hold on
# Nov 14th 2017, 16:32 inoas diego182 and how would that example work if you wanted articles that matched to Tag CakePHP AND to Tag ORM?
# Nov 14th 2017, 16:30 diego182 just consider the fallowing "As this function will create an INNER JOIN, you might want to consider calling distinct on the find query as you might get duplicate rows if your conditions don’t exclude them already. This might be the case, for example, when the same users comments more than once on a single article."
# Nov 14th 2017, 16:28 diego182 theres an example just like you need
# Nov 14th 2017, 16:27 diego182 https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#filtering-by-associated-data-via-matching-and-joins
# Nov 14th 2017, 16:27 diego182 i would go with matching
# Nov 14th 2017, 16:16 inoas leftJoinWith group and count?
# Nov 14th 2017, 16:14 inoas can this be done with innerJoin or leftJoin instead of matching or is matching the way to go?
# Nov 14th 2017, 16:13 inoas where posts HABTM tags
# Nov 14th 2017, 16:13 inoas my brain is stuck today on ORM: I want to fetch a post that has at minium tag A and tag B
# Nov 14th 2017, 16:05 acosonic lol, I didn't know my avatar was that ugly,while on irc
# Nov 14th 2017, 15:08 birdy247 @flavius thanks
# Nov 14th 2017, 14:23 nooot77 hey man
# Nov 14th 2017, 14:17 flavius and in development, if the other site changes and adds more functionality, tell him that you need to analyze that and decide how much time it will take you to implement it and how much it will cost him on top of the existing price