Log message #4055426

# At Username Text
# Jul 21st 2017, 14:24 devito so the images table would be polymorphic as it belongs to both pages and posts but we would use foreign key and model to designate which one
# Jul 21st 2017, 14:23 devito imagine a images table that belongs to posts and pages however insted of a post_id / page_id we have a foreign_key and model column
# Jul 21st 2017, 14:22 mirec devito: what do you mean
# Jul 21st 2017, 14:22 devito has anyone experimented with polymorphic models in 3.x?
# Jul 21st 2017, 14:22 devito hello all
# Jul 21st 2017, 14:21 gutts yup filter does it. sweet thanks mirec
# Jul 21st 2017, 14:17 mirec https://book.cakephp.org/3.0/en/orm/query-builder.html#adding-calculated-fields
# Jul 21st 2017, 14:16 mirec on your resultset try $resultSet->filter(function($post){return count($post->comments) > 1})
# Jul 21st 2017, 14:15 mirec I do not think cachecounter will be helpful since you need Comments filtered dynamically by user_id
# Jul 21st 2017, 14:14 gutts or a cache counter
# Jul 21st 2017, 14:14 gutts ok, ill try to use mapreduce for that
# Jul 21st 2017, 14:13 mikesmoniker Is there a trick to getting cakephp-queuesadilla to use Predis? When I specify a className in the config, it gets overwritten to Redis because the DSN starts with redis://. cc @savant
# Jul 21st 2017, 14:12 mirec hasMany generates another query, so you cant use simple having mysql syntax. alternatively you can try CollectionTrait::filter()
# Jul 21st 2017, 14:09 mirec try mapReduce https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#map-reduce
# Jul 21st 2017, 14:01 gutts what about the having, how do i reference comments in relation to that?
# Jul 21st 2017, 14:00 gutts got that part
# Jul 21st 2017, 13:58 chris-andre https://book.cakephp.org/3.0/en/orm/query-builder.html#passing-conditions-to-contain
# Jul 21st 2017, 13:56 gutts so queryBuilder is a magic keyword?
# Jul 21st 2017, 13:56 chris-andre I think you could `->contain(['Comments' => ['queryBuilder' => function ($q) { return $q->where(['Comments.user_id !=' => 2]])`
# Jul 21st 2017, 13:55 gutts initially i tried to do this within comments but i need the structure reversed to parse
# Jul 21st 2017, 13:55 gutts i have two models - posts and comments. posts has a hasMany->Comments and Comments belongsTo posts
# Jul 21st 2017, 13:54 gutts in the overall scheme i need to apply a where clause on a hasMany and also need a having count > 1 of comments. so i want all active posts that have at least one comment and its not written by X user
# Jul 21st 2017, 13:54 chris-andre Right, and what column is not found? Comments.user_id?
# Jul 21st 2017, 13:53 gutts sorry, i meant posts
# Jul 21st 2017, 13:53 chris-andre @gutts Singular Post, Is it a typo in your code or just here?
# Jul 21st 2017, 13:48 chris-andre You want to find active posts containing comments where the comments are not written by an $user_id.
# Jul 21st 2017, 13:48 gutts so what are my options?
# Jul 21st 2017, 13:47 gutts oh, i guess it's because hasMany relations aren't left joined?
# Jul 21st 2017, 13:46 gutts should I define that condition in a duplicate relation with that extra condition, or what?
# Jul 21st 2017, 13:46 gutts and $this->find() is within Post model
# Jul 21st 2017, 13:46 gutts err, with a $this->find()->contain('Comments')
# Jul 21st 2017, 13:46 gutts chris-andre - for ex my 'Post' model hasMany 'Comments', now im trying to $this->find()->where(['Post.is_active' => 1, 'Comments.user_id IS NOT' => 2 ]);
# Jul 21st 2017, 13:44 rquadling Hi @gutts
# Jul 21st 2017, 13:44 chris-andre @gutts Tried ->where([Table.column]) ?
# Jul 21st 2017, 13:44 gutts hi rquadling
# Jul 21st 2017, 13:40 gutts i assume that's what I have to do
# Jul 21st 2017, 13:40 gutts should I create a new relation with special conditions?
# Jul 21st 2017, 13:40 gutts I contained a hasMany relation table in my model, but when I do a ->where it says the column doesnt exist
# Jul 21st 2017, 13:25 adriencs thanks @chris-andre @neon1024
# Jul 21st 2017, 13:20 maymeow how can i share access rights to folder between docker containers??? i have git containers and need write access for php-fpm container
# Jul 21st 2017, 13:17 cleptric Just ask your question here and someone may help you :slightly_smiling_face: