Log message #4192525

# At Username Text
# 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
# Jul 9th 2019, 14:25 neon1024 Ah, I bet it’s my listener filtering the associated query, although I did set a check on `$primary`
# Jul 9th 2019, 14:23 neon1024 I set a `user_id` to my entity in the controller, using the currently logged in users id, however my entity has errors for `user_id (array) _existsIn This value does not exist` and I have no idea why when the value is there
# Jul 9th 2019, 14:19 admad ;)
# Jul 9th 2019, 14:19 jeremy.payne @admad you sent me on the right track. looks like the nginx config (I don't have access to it) is catching all non POST/GET stuff and forcing an error page for them.
# Jul 9th 2019, 14:13 admad np
# Jul 9th 2019, 14:13 jeremy.payne I was hoping it wasn't so I don't have to spend too many hours digging, but it looks like I do. I'll continue investigating. Thanks for your help @neon1024 and @admad
# Jul 9th 2019, 14:12 jeremy.payne Yeah, I'm suspecting it's something in the project's config/setup
# Jul 9th 2019, 14:12 admad looks like your webserver itself is block the requests
# Jul 9th 2019, 14:11 admad it's strange that you get a 405 before controller's beforeFilter is reached
# Jul 9th 2019, 14:10 jeremy.payne I lose the ability to read the list of accepted domains from the db by doing that way sadly
# Jul 9th 2019, 14:07 admad you don't event need to bother with php code. just check request type and return required header in .htacccess / nginx config
# Jul 9th 2019, 14:07 jeremy.payne Cake version is `2.6.8` if that helps
# Jul 9th 2019, 14:07 jeremy.payne but I could allow it on the whole project
# Jul 9th 2019, 14:06 jeremy.payne @admad I have a whole `API` plugin with all the stuff that would require the `options` method to work