Log message #4188837

# At Username Text
# Jun 7th 2019, 21:12 challgren I needed the CSV imports before the rest of the app so it was whipped together in about 10 minutes for the client so I could actually work on the other stuff. It wasn’t too hard to do. They upload through the website and it creates a Queue Job that then does the data import since I can sometimes see large files +1000 records
# Jun 7th 2019, 21:03 hollistergraham123 Yeah, I’ve got requests for CSV imports and i’ve been putting it off lol
# Jun 7th 2019, 20:41 challgren Ok cool, This script is a Shell Task so it was a bit screwy when I first wrote it
# Jun 7th 2019, 20:40 hollistergraham123 Just heads up looks like $this is still available inside the transaction function and references the table model so we don’t need to pass that in
# Jun 7th 2019, 20:11 challgren It was written awhile ago $Table should really be $this->Equipments
# Jun 7th 2019, 20:11 challgren The code before
# Jun 7th 2019, 20:09 hollistergraham123 I noticed you use the $Table variable but later you query off the $this variable
# Jun 7th 2019, 20:09 hollistergraham123 What does this reference?
# Jun 7th 2019, 20:07 hollistergraham123 @challgren Awesome, Thank!
# Jun 7th 2019, 20:03 challgren Just make sure to use `use` if you want vars available in the callback
# Jun 7th 2019, 20:02 ricksaccous oh cool
# Jun 7th 2019, 20:01 challgren Using transactional() rolls back/commits automagically
# Jun 7th 2019, 20:01 ricksaccous my bad
# Jun 7th 2019, 20:01 ricksaccous lol yeah that makes sense
# Jun 7th 2019, 20:01 ricksaccous if something fails it all just rolls back?
# Jun 7th 2019, 20:00 ricksaccous oh you don't have to specify rollbacks?
# Jun 7th 2019, 20:00 challgren This is my usage of transactional
# Jun 7th 2019, 19:59 ricksaccous haven't used it in a while
# Jun 7th 2019, 19:59 ricksaccous I think that's how it works anyway
# Jun 7th 2019, 19:59 ricksaccous if it doesn't save
# Jun 7th 2019, 19:59 ricksaccous yeah and you can put in if statements and rollbacks
# Jun 7th 2019, 19:58 hollistergraham123 Or can I do this?
# Jun 7th 2019, 19:57 hollistergraham123 Right I have that page open. But I mean utilizing the ORM. so I can do $this->Table->save() still
# Jun 7th 2019, 19:56 challgren @hollistergraham123 https://book.cakephp.org/3.0/en/orm/database-basics.html#using-transactions
# Jun 7th 2019, 19:55 hollistergraham123 Is there some way to wrap a series of ORM queries and have it roll back all of them if any of them fail?
# Jun 7th 2019, 13:47 niel45 I don't see a problem with miltiple loops though. Separate them into their own methods if you want to keep the concerns separate though
# Jun 7th 2019, 13:47 niel45 if you're worried about too many foreachs, do the processing of the "2" arrays as part of the one loop. i.e. call different methods based on the date
# Jun 7th 2019, 13:46 scuadra and thank you for your time
# Jun 7th 2019, 13:46 scuadra @ricksaccous ok
# Jun 7th 2019, 13:45 ricksaccous @scuadra well if you want play with Hash:: but i don't think in the end it will do anything different, especially since I doubt it will natively do the date comparisons for you
# Jun 7th 2019, 13:43 scuadra @ricksaccous I want to divide the initial array and then to foreach the resulting 2 arrays. I thought there will be too many foreach's
# Jun 7th 2019, 13:42 niel45 yup, KISS
# Jun 7th 2019, 13:41 ricksaccous I mean when it's easy enough to just foreach it i'd just do that
# Jun 7th 2019, 13:41 scuadra I thought there is a better way using Hash::extract or Hash:combine
# Jun 7th 2019, 13:40 ricksaccous what's wrong with a loop and check?
# Jun 7th 2019, 13:39 scuadra How can I divide the array to 2 other arrays based on the date_start is before or after the current date?
# Jun 7th 2019, 13:37 slackebot 'image' => '/images/products/2.jpg' ), 'Category' => array( 'id' => '3', 'name' => 'My Category 3' ) ), ... )
# Jun 7th 2019, 13:37 scuadra Let's say I have the following array array( (int) 0 => array( 'Product' => array( 'id' => '1', 'category_id' => '2', 'title' => 'Product1', 'date_start' => '2019-03-10', 'image' => '/images/products/1.jpg' ), 'Category' => array( 'id' => '2', 'name' => 'My Category 2' ) ), (int) 1 => array( 'Product' => array( 'id' => '2', 'category_id' => '3', 'titleg' => 'Product2', 'date_start' => '2019-07-01',
# Jun 7th 2019, 13:36 scuadra Hello. I have a question regarding Cake 2.x
# Jun 7th 2019, 12:16 yamcomnet anyone got dropzone.js working with cake securityComponent ?
# Jun 7th 2019, 11:39 neon1024 We implemented a Middleware to change the headers to match our requirements