# |
Dec 12th 2019, 15:03 |
neothermic |
it's known as an implicit commit |
# |
Dec 12th 2019, 15:03 |
neothermic |
s/begin/start/ |
# |
Dec 12th 2019, 15:02 |
neothermic |
if you try something like: `begin transaction; {SQL statements}; begin transaction;` MySQL treats the second `begin transaction;` as if you wrote `commit; begin transaction;` |
# |
Dec 12th 2019, 15:01 |
ricksaccous |
not* |
# |
Dec 12th 2019, 15:01 |
ricksaccous |
i suppose i can't rely on transactions in my afterSave cause that's now how things work, heh |
# |
Dec 12th 2019, 15:01 |
ricksaccous |
i see, everything i'm doing here is on the same connection |
# |
Dec 12th 2019, 15:00 |
neothermic |
yes, as long as they're in different connections |
# |
Dec 12th 2019, 15:00 |
ricksaccous |
in mysql? |
# |
Dec 12th 2019, 15:00 |
ricksaccous |
is it possible to have multiple transactions at once |
# |
Dec 12th 2019, 15:00 |
ricksaccous |
i need an independent transaction |
# |
Dec 12th 2019, 14:59 |
ricksaccous |
i think i know why this is |
# |
Dec 12th 2019, 14:51 |
ricksaccous |
*Error:* The afterSave event in "Cases\Model\Table\CasesTable" is aborting the transaction before the save process is done. |
# |
Dec 12th 2019, 14:49 |
ricksaccous |
when I do something like $this->OtherTable->getConnection()->begin(); /** other logic here **/ $this->OtherTable->getConnection()->rollback(); I get this error: |
# |
Dec 12th 2019, 14:48 |
ricksaccous |
so i have transactional logic related to other tables in my afterSave of my CasesTable |
# |
Dec 12th 2019, 14:27 |
Manu90 |
NULL$referralCode = $this->request->getCookie('referralCode');Please help me |
# |
Dec 12th 2019, 14:27 |
Manu90 |
->withExpiry(new \DateTime('+1 year')) ->withPath('/') ->withSecure(false) ->withHttpOnly(true); $cookies = $cookies->add($cookie); $this->response = $this->response->withCookie($cookie); }And after some time i come on this page again and get cookie but getting |
# |
Dec 12th 2019, 14:27 |
Manu90 |
Hi allI have facing some issue with cookies so please help me.I have created cookie on signup page like below:if($this->request->getQuery('referral') andand !$cookies->has('referralCode')){ $cookie = (new \Cake\Http\Cookie\Cookie('referralCode')) ->withValue($this->request->getQuery('referral')) |
# |
Dec 12th 2019, 14:05 |
slackebot2 |
->withSecure(false) ->withHttpOnly(true); $cookies = $cookies->add($cookie); $this->response = $this->response->withCookie($cookie); } And after some time i come on this page again and get cookie but getting NULL $referralCode = $this->request->getCookie('referralCode'); Please help me |
# |
Dec 12th 2019, 14:05 |
yadav.manu36 |
Hi all I have facing some issue with cookies so please help me. I have created cookie on signup page like below: if($this->request->getQuery('referral') andand !$cookies->has('referralCode')){ $cookie = (new \Cake\Http\Cookie\Cookie('referralCode')) ->withValue($this->request->getQuery('referral')) ->withExpiry(new \DateTime('+1 year')) ->withPath('/') |
# |
Dec 12th 2019, 13:32 |
neothermic |
so https://book.cakephp.org/3/en/views/helpers/form.html#customizing-the-templates-formhelper-uses and https://book.cakephp.org/3/en/views/helpers/form.html#adding-custom-widgets be my reading? |
# |
Dec 12th 2019, 13:31 |
dereuromark |
the latter also, with a custom widget |
# |
Dec 12th 2019, 13:30 |
dereuromark |
order is easy, custom template code |
# |
Dec 12th 2019, 13:28 |
neothermic |
in cake 3, is there a way to either: a) change the order of the selects rendered for a date input, or b) make it spit out a HTML5 date picker? |
# |
Dec 12th 2019, 13:27 |
info315 |
if a child crash, the daemon itself will restart it. if the main daemon crashes systemd will restart it |
# |
Dec 12th 2019, 13:20 |
challgren |
What happens when the process crashes? |
# |
Dec 12th 2019, 13:18 |
dereuromark |
respawning as I showed above every x minutes is a safer and less error prone concept. |
# |
Dec 12th 2019, 13:18 |
dereuromark |
thats an anti pattern IMO, for php related background work. |
# |
Dec 12th 2019, 13:15 |
info315 |
Long Running^^: `Active: active (running) since Mo 2019-11-18 09:31:05 CET; 3 weeks 3 days ago` |
# |
Dec 12th 2019, 13:13 |
info315 |
Ok perfect, thanks! |
# |
Dec 12th 2019, 13:12 |
ndm |
If the automatic reconnect doesn't work, I'd check why it doesn't work though, and then maybe implement a custom retry command / strategy. |
# |
Dec 12th 2019, 13:10 |
ndm |
Probably best to throw an `isConnected()` in there too, but yes, that should work, assuming only a single connection is being used... |
# |
Dec 12th 2019, 13:09 |
info315 |
If yes i assume this is the way to go? ``` $connection = $SystemsettingsTable->getConnection(); $connection->disconnect(); $connection->connect();``` |
# |
Dec 12th 2019, 13:08 |
info315 |
@ndm perfect I will try this with an testing shell if the reconnecting thing is still required with cake4. |
# |
Dec 12th 2019, 13:04 |
ndm |
@info315 You can always call `disconnect()/connect()` on the connection, but that should happen automatically now, check `\Cake\Database\Connection::getDisconnectRetry()` |
# |
Dec 12th 2019, 13:01 |
dereuromark |
E.g. https://github.com/dereuromark/cakephp-queue has been processing millions of DB based jobs like this. without a single incident. maybe a better fit, if you want to have a simple and single connection until job finishs and closes the worker down. especially for low traffic sites the perfect fit, because of its 0 dependencies and lightweight approach. |
# |
Dec 12th 2019, 13:00 |
info315 |
that's as good as reconnect. |
# |
Dec 12th 2019, 13:00 |
info315 |
how can i open and close a the mysql session with cakephp? |
# |
Dec 12th 2019, 12:59 |
steinkel |
^this |
# |
Dec 12th 2019, 12:59 |
dereuromark |
why dont they open up the connection as needed? they should trigger a php job, open and close after done. |
# |
Dec 12th 2019, 12:59 |
info315 |
but this issue is beyond the queue. because my worker is a php daemon (a cakephp command to be exactly). |
# |
Dec 12th 2019, 12:58 |
info315 |
RabbitMq and Gearman |