# |
Nov 20th 2019, 15:02 |
tobias.weichart |
i guess the thing is, that after triggering the transaction, the autocommit for the connection is set to false, with no easy way of setting it back to true. hence all further queries on that connection need to be committed manually. manually resetting would probably work: `$conn->getDriver()->getConnection()->setAttribute(PDO::ATTR_AUTOCOMMIT,0);` (not tested) resetting the whole connection would work too, i guess... |
# |
Nov 20th 2019, 15:01 |
eax |
Thanks @admad, I’ll try it out tomorrow :slightly_smiling_face: Have a great evening all! |
# |
Nov 20th 2019, 15:00 |
admad |
@eax you either commit() a transaction or abort() it, but like @tobias.weichart said you might be better off using transactional() |
# |
Nov 20th 2019, 14:49 |
eax |
@tobias.weichart Good point, I’ll have to try that, thanks! :slightly_smiling_face: |
# |
Nov 20th 2019, 14:46 |
tobias.weichart |
do you achieve anything different when using `$conn->transactional()` ? |
# |
Nov 20th 2019, 14:40 |
eax |
And doing a commit() before the function ends, makes them get saved correctly |
# |
Nov 20th 2019, 14:39 |
eax |
@tobias.weichart I have to save some other data after I’ve finished the transaction, and if I save it after the commit() they aren’t saved |
# |
Nov 20th 2019, 14:36 |
tobias.weichart |
or do you need to open/close connections because of any reasons? |
# |
Nov 20th 2019, 14:36 |
tobias.weichart |
opening and closing connections shouldn't be of any concern to you, imho |
# |
Nov 20th 2019, 14:35 |
tobias.weichart |
according to the cakePHP 3.x documentation (https://book.cakephp.org/3/en/orm/database-basics.html#using-transactions) a transaction should work like this: ```$conn->begin(); $conn->execute('UPDATE articles SET published = ? WHERE id = ?', [true, 2]); $conn->execute('UPDATE articles SET published = ? WHERE id = ?', [false, 4]); $conn->commit();``` |
# |
Nov 20th 2019, 14:32 |
eax |
Doing $connection->disconnect() was not enough :S |
# |
Nov 20th 2019, 14:28 |
eax |
Hey folks! Cake3 question: How do I end a transaction after doing $connection->begin(); ? :slightly_smiling_face: |
# |
Nov 20th 2019, 14:03 |
mehov |
@admad gotcha, thanks again |
# |
Nov 20th 2019, 14:02 |
pieceof |
then terehe you put 'publishableKey' => Configure::read(yorfavcolor), |
# |
Nov 20th 2019, 14:02 |
admad |
still bootstarp |
# |
Nov 20th 2019, 14:00 |
mehov |
@admad thanks for your reply i'm not writing the keys though, i have the following file under APP/config ```<?php return [ 'Stripe' => [ // retrieve at dashboard.stripe.com/apikeys 'publishableKey' => '', 'secretKey' => '', 'apiVersion' => '', ] ];``` and that's how the keys are set, does that make a difference? still bootstrap? |
# |
Nov 20th 2019, 13:56 |
admad |
for Configure::write() that is |
# |
Nov 20th 2019, 13:56 |
admad |
@mehov neither, set the keys in boostrap |
# |
Nov 20th 2019, 13:54 |
slackebot |
https://stackoverflow.com/questions/29780380/in-cakephp-3-0-what-is-the-difference-between-initialize-and-beforefilter but the answers are not clear enough for me. Please advise |
# |
Nov 20th 2019, 13:54 |
mehov |
Hi everyone, I installed stripe-php via composer and want to globally configure the api keys and the preferred api version. It will look like this: \Stripe\Stripe::setApiKey(Configure::read('Stripe.secretKey')); \Stripe\Stripe::setApiVersion(Configure::read('Stripe.apiVersion')); Figured I should put it inside AppController.php, but unsure if it goes under `beforeFilter()` or `initialize()`. I found |
# |
Nov 20th 2019, 13:40 |
mehov |
https://cakesf.slack.com/archives/C053DPNGT/p1574254643156800 last time i got a curl timeout that looked like this, it was because i used a wrong array key to pass my AWS credentials |
# |
Nov 20th 2019, 13:22 |
admad |
hehe |
# |
Nov 20th 2019, 13:20 |
dereuromark |
in their heart, they remain loyal, for sure |
# |
Nov 20th 2019, 13:20 |
dereuromark |
right right :slightly_smiling_face: |
# |
Nov 20th 2019, 13:12 |
admad |
@dereuromark most likely they shifted to laravel https://www.loadsys.com/loadsys-adds-laravel-framework-arsenal/ |
# |
Nov 20th 2019, 12:57 |
maymeow |
`Cake\Http\Exception\HttpException: cURL Error (28) Operation timed out after 30000 milliseconds with 0 bytes received` any ideas what to with this? |
# |
Nov 20th 2019, 12:55 |
michal.ferak |
Yes, it looks good for what it’s for! |
# |
Nov 20th 2019, 12:53 |
dereuromark |
https://github.com/loadsys/CakePHP-Sitemap could probably be added to the list anyway for 3.x - not sure why they didnt do it yet, but that is more than just a view class ;) so yours would probably still be a different lightweight plugin of some sorts. |
# |
Nov 20th 2019, 12:51 |
dereuromark |
tip: https://github.com/FriendsOfCake/awesome-cakephp/wiki has one listed as todo. |
# |
Nov 20th 2019, 12:50 |
michal.ferak |
@admad @dereuromark Thanks for the ideas! Yes, the awesome list was my starting point but didn’t see anything relevant there. I’ll think of how to turn this into a community plugin, if/when I succeed. :slightly_smiling_face: |
# |
Nov 20th 2019, 12:49 |
dereuromark |
and you could even make it a plugin then for the community. PS: check if the awesome list of 3.x or 2.x might even already contain some beginning ideas here. |
# |
Nov 20th 2019, 12:48 |
admad |
@michal.ferak yes that's the right idea |
# |
Nov 20th 2019, 12:46 |
dereuromark |
You could look how cakephp-feed plugin does it, also might make sense to have your own View class here for it maybe (like https://github.com/dereuromark/cakephp-feed/blob/master/src/View/RssView.php etc). |
# |
Nov 20th 2019, 12:45 |
michal.ferak |
@admad Thanks. Trying to figure that out now. Doing something like: ```$xmlArray = [ 'urlset' => [ 'xmlns:' => 'http://www.sitemaps.org/schemas/sitemap/0.9', 'xmlns:xhtml' => 'http://www.w3.org/1999/xhtml', 'url' => $url, ] ]; $xmlObject = \Cake\Utility\Xml::fromArray($xmlArray); echo $xmlObject->asXML();``` |
# |
Nov 20th 2019, 12:44 |
admad |
@michal.ferak the serialization feature will only generate output based on the view variables sets, you can't make it generate xml tags as you are trying to do. You can/should still use XmlView but without serialization feature |
# |
Nov 20th 2019, 12:36 |
maymeow |
can i use http client to call api on localhost:8765? (its sam application from wihich i making call) |
# |
Nov 20th 2019, 12:26 |
birdy247 |
is anyone using xdebug with vagrant? |
# |
Nov 20th 2019, 12:17 |
michal.ferak |
Should I instead not use _serialize and write a custom view? |
# |
Nov 20th 2019, 12:16 |
michal.ferak |
I assume this is not the correct way of doing this, as I’m getting a 500 - “Namespace Error” |
# |
Nov 20th 2019, 12:16 |
slackebot |
'http://www.w3.org/1999/xhtml', 'url' => $urls, '_serialize' => ['@xmlns', '@xmlns:xhtml', 'url'] ])``` |
# |
Nov 20th 2019, 12:16 |
michal.ferak |
Hi! I’m trying to generate a sitemap using XML view using _serialize (following the instructions in docu). However, for my needs I also need to add xml:link to each <loc> - this needs registering xmlns:xhtml in the document root. This is what my set methods look like: ```$this->set('_rootNode', 'urlset'); $this->set([ '@xmlns' => 'http://www.sitemaps.org/schemas/sitemap/0.9', '@xmlns:xhtml' => |