Log message #4108701

# At Username Text
# Jan 12th, 16:31 bigdaddygee Humm, do someone know how I can inject a count of another table into a resultset ? (Actualy I got the list instead of the count)
# Jan 12th, 16:19 neon1024 https://book.cakephp.org/3.0/en/orm/query-builder.html#automatically-creating-in-clauses
# Jan 12th, 16:18 danishkhan3621 is there any link of tutorials where i can get fetching result of these types.
# Jan 12th, 16:17 neon1024 Still, at least there is finally a `.forEach()`
# Jan 12th, 16:16 neon1024 Well, I suppose technically it’s a hash of objects as strictly speaking Javascript doesn’t have arrays
# Jan 12th, 16:16 danishkhan3621 @neon1024: Thanks
# Jan 12th, 16:15 neon1024 So you’ll have to fix that ;)
# Jan 12th, 16:15 neon1024 It’s an array of objects
# Jan 12th, 16:15 neon1024 What you’ve got there is JSON
# Jan 12th, 16:14 neon1024 This is not an array unfortunatly, `My array is [{"category_id":1},{"category_id":4}] `
# Jan 12th, 16:14 neon1024 Yeah, of course
# Jan 12th, 16:14 danishkhan3621 this does not return any result because i have to assign category_id key to an array
# Jan 12th, 16:13 danishkhan3621 @neon1024: `$get_all_categories_prd_id = $this->Products->find('all',array('conditions'=>array('category_id IN'=>$get_all_categories_p_id)));`
# Jan 12th, 16:10 neon1024 But that’s personal preference
# Jan 12th, 16:10 neon1024 You should also really consider changing your variable names to use the CakePHP coding standard
# Jan 12th, 16:10 danishkhan3621 @neon1024: is there any other way to do it without loop.
# Jan 12th, 16:09 neon1024 There is also no need to use a loop, as you can just transform the array and use `'id IN' => $array`
# Jan 12th, 16:09 neon1024 You should also not use `count()` in a for loop as it causes count to be executed in every iteration
# Jan 12th, 16:08 neon1024 If your array is JSON, you might struggle to use it in PHP ;)
# Jan 12th, 16:08 neon1024 <- Click the [+] button and click on the ‘Code or text snippet’
# Jan 12th, 16:02 danishkhan3621 How can i run find query to search records from an array : My array is [{"category_id":1},{"category_id":4}] and i'm running query like this for($i=0; $i<count($get_all_categories_p_id); $i++) { $get_all_categories_prd_id = $this->Products->find('all',array('conditions'=>array('category_id IN'=>$get_all_categories_p_id[$i]['category_id']))); $product_List[]=$get_all_categories_prd_id; }
# Jan 12th, 15:34 jotpe is there any possibility to run composers `post-update-cmd` for _production_ or _development_?
# Jan 12th, 15:22 xavier83ar ok, thanks!
# Jan 12th, 15:20 jota then rollback
# Jan 12th, 15:20 jota got the query
# Jan 12th, 15:20 jota @xavier83ar use a begin tran.
# Jan 12th, 15:19 dereuromark without actual params
# Jan 12th, 15:19 dereuromark debug((string)$query) only shows the query
# Jan 12th, 15:19 jota You could use a begin trans... without commit.
# Jan 12th, 15:19 dereuromark This was the issue to it xavier: https://github.com/cakephp/debug_kit/issues/568
# Jan 12th, 15:18 jotpe @learningcake: this one is good: https://paulund.co.uk/datetime-php otherwise you can also use Cake's Time Utility: https://book.cakephp.org/3.0/en/core-libraries/time.html
# Jan 12th, 15:15 xavier83ar I need run a deleteAll() query, and I want to check the query that the orm will run
# Jan 12th, 15:13 xavier83ar Hi, is there a way of getting the plain sql that the ORM will run without actually running it?
# Jan 12th, 15:12 learningcake my bad
# Jan 12th, 15:11 learningcake Thank you. works now
# Jan 12th, 15:04 learningcake ok
# Jan 12th, 15:03 jotpe better use a type which fits to the date (e.g. datetime) and compare with a php datetime object
# Jan 12th, 15:02 learningcake varchar
# Jan 12th, 15:02 learningcake the column type is var
# Jan 12th, 15:01 jotpe maybe the mysql column is datetime
# Jan 12th, 15:01 jotpe What is the _type_ of the mysql date? You could try to find everything and debug the date. Maybe it's in another format?