# |
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 |
# |
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 |