Log message #4192539

# At Username Text
# Jul 9th 2019, 18:10 brian493 but it don't work, just runs all my queries as if there was no transaction
# Jul 9th 2019, 18:10 brian493 $conn = $this->Model->getDataSource();
# Jul 9th 2019, 18:10 brian493 according to the docs cake2 is the exact same except the first line is different
# Jul 9th 2019, 18:10 gunner1095 That's it.
# Jul 9th 2019, 18:10 gunner1095 $conn->commit();
# Jul 9th 2019, 18:10 gunner1095 sql stuff
# Jul 9th 2019, 18:09 gunner1095 $conn->begin();
# Jul 9th 2019, 18:09 gunner1095 $conn = ConnectionManager::get('default');
# Jul 9th 2019, 18:09 gunner1095 In cake 3 I just do...
# Jul 9th 2019, 18:07 brian493 I'll just rewrite my code with PDO it's not a huge deal
# Jul 9th 2019, 18:07 brian493 idk what I'm doing wrong I'm following the directions verbatim but they just act as if I'm not in a transaction
# Jul 9th 2019, 18:06 gunner1095 Transactions are pretty straight forward in cake 3, not sure about 2.
# Jul 9th 2019, 18:05 brian493 ok, failing that anybody know on hand how to just access the PDO object directly so I can write my own code?
# Jul 9th 2019, 18:02 brian493 anybody have experience with them?
# Jul 9th 2019, 18:02 brian493 still struggling to get transactions to work in cake2
# Jul 9th 2019, 15:55 gunner1095 Hi, can anyone help me with an issue I'm having with custom data types?
# Jul 9th 2019, 15:15 neon1024 The more you look at the clock, the slower time moves :thinking_face:
# Jul 9th 2019, 15:15 neon1024 Probably ill advised I’d imagine
# Jul 9th 2019, 15:15 neon1024 Or nuke the site from orbit I suppose and destroy the instance in the registry
# Jul 9th 2019, 15:13 neon1024 So you do have to `removeBehavior` execute code `addBehavior` again after
# Jul 9th 2019, 15:13 neon1024 As it’s using the Registry Pattern, the instance will be stored and returned if it already exists
# Jul 9th 2019, 15:13 neon1024 The answer I think is, yes, if you remove a behaviour it will effect all instances of that class
# Jul 9th 2019, 15:12 ricksaccous lol
# Jul 9th 2019, 15:12 neon1024 Well you’ve done a super job at repeating my question though 8)
# Jul 9th 2019, 15:12 ricksaccous meh i'm bad at explaining
# Jul 9th 2019, 15:11 ricksaccous i mean, for code executed afterwards you won't have it
# Jul 9th 2019, 15:11 ricksaccous lol
# Jul 9th 2019, 15:11 ricksaccous I'd imagine once you disable a behavior for code executed afterwards it works fine, if it never reaches the code where you are removing it you're fine
# Jul 9th 2019, 15:09 neon1024 Can I disable a behaviour just for a single bit of code? Or is that a matter of removing it and readding it
# Jul 9th 2019, 15:01 neon1024 Only just found the neat shortcut `->removeBehvior()` :face_palm:
# Jul 9th 2019, 14:48 brian493 but it's definitely not running my code in a transaction--I shouldn't be able to see it filling rows in I should just be able to see once it's done
# Jul 9th 2019, 14:48 brian493 I'm doing this: ``` $dataSource = $this->getDataSource(); $dataSource->begin(); .. call create() and then save() on my model here a bunch of times in a loop .. $dataSource->commit(); ```
# Jul 9th 2019, 14:47 brian493 new question. while I was testing that I refreshed my table and I could see it filling the table with rows in realtime. shouldn't I only see new rows after the transaction completes?
# Jul 9th 2019, 14:46 brian493 ok so I can do a DELETE FROM and that will work
# Jul 9th 2019, 14:44 brian493 hmm I think you are right
# Jul 9th 2019, 14:44 dereuromark never done it inside transactions tbh
# Jul 9th 2019, 14:43 dereuromark is truncation maybe not a recoverable (transaction safe) op?
# Jul 9th 2019, 14:43 brian493 question, in cake2 I'm calling $this->Modal->query('TRUNCATE TABLE MyTable'); inside a transaction which isn't working (It's truncating the table as if it was run outside of the transaction). What is the correct way to truncate a table so that it occurs within the transaction?
# Jul 9th 2019, 14:41 rochasmarcelo @newyorknick how are you reading the data from session?
# Jul 9th 2019, 14:35 half2me everywhere where I have problems, its always inside of a beforeSave()
# Jul 9th 2019, 14:29 half2me I know it has something to do with it being run inside of a transaction