# |
Oct 5th 2016, 20:09 |
slackebot |
Action: admad applauds lorenzo's choice of method name |
# |
Oct 5th 2016, 20:03 |
backstageel |
I will try that |
# |
Oct 5th 2016, 20:02 |
lorenzo |
backstageel ^^ |
# |
Oct 5th 2016, 20:01 |
lorenzo |
```explodingSave($this->Users, $data)``` |
# |
Oct 5th 2016, 20:01 |
lorenzo |
```function explodingSave($model, $data) { if (!$model->save($data)) { throw new Exception; } return true}``` |
# |
Oct 5th 2016, 19:59 |
dereuromark |
you can internally wrap save() I bet |
# |
Oct 5th 2016, 19:59 |
dereuromark |
ah ok, I thought 3.x |
# |
Oct 5th 2016, 19:59 |
backstageel |
Cake 2.x |
# |
Oct 5th 2016, 19:59 |
backstageel |
I want that even for Forms... because i catch the errors on the controllers, before show validation errors to the user |
# |
Oct 5th 2016, 19:58 |
dereuromark |
like when importing sth via shell, or some cronjob work |
# |
Oct 5th 2016, 19:58 |
dereuromark |
but I would also like to have this for normal save operations etc |
# |
Oct 5th 2016, 19:58 |
dereuromark |
not always you want that, for forms example you dont |
# |
Oct 5th 2016, 19:57 |
backstageel |
So i can keep write just $this->save($data) and exception is thrown on validation errors |
# |
Oct 5th 2016, 19:57 |
backstageel |
Is there a better way to override save method to throw exceptions on validation errors? |
# |
Oct 5th 2016, 19:56 |
backstageel |
The problem is to write this code everytime i want to save... |
# |
Oct 5th 2016, 19:56 |
backstageel |
The ideia is to Throw Exception on validation error... i want to catch the exceptions on the controllers |
# |
Oct 5th 2016, 19:55 |
dereuromark |
yeah me too often times |
# |
Oct 5th 2016, 19:55 |
backstageel |
I use this code whenever i want to save data to database: if (!$this->save($data)) { throw new DataNotSavedException($this->validationErrors); } |
# |
Oct 5th 2016, 19:53 |
backstageel |
Hello Everyone |
# |
Oct 5th 2016, 19:43 |
dereuromark |
@lorenzo yeah but weird that it worked for mysql |
# |
Oct 5th 2016, 18:57 |
xymanek |
:+1: |
# |
Oct 5th 2016, 18:56 |
cleptric |
:thumbsup: |
# |
Oct 5th 2016, 18:56 |
cleptric |
Yep, sth. like that was the problem Now it also works in the app routes |
# |
Oct 5th 2016, 18:56 |
xymanek |
eg. `Router::plugin('DebugKit', /* ... */)` in both `routes.php`? |
# |
Oct 5th 2016, 18:55 |
xymanek |
are you sure there was no overlap? |
# |
Oct 5th 2016, 18:55 |
xymanek |
@cleptric really? it's ofc better to put plugin routes in plugin's `routes.php` but it should work in app's `routes.php` too |
# |
Oct 5th 2016, 18:54 |
cleptric |
@xymanek Thank you :slightly_smiling_face: I also had to do this in the routes.php of the plugin. Tried it the the app routes... |
# |
Oct 5th 2016, 18:50 |
xymanek |
http://book.cakephp.org/3.0/en/development/routing.html#Cake\Routing\Router::plugin second example |
# |
Oct 5th 2016, 18:49 |
cleptric |
I thought about sth like that ``` $routes->connect('/api/*', ['plugin' => 'Api/V1']); ``` |
# |
Oct 5th 2016, 18:47 |
cleptric |
I want to redirect all /api/* requests to a new Plugin called Api/V1. Is there a generic way to do this? |
# |
Oct 5th 2016, 18:23 |
NeoThermic |
dereuromark: I think I did it \o/ |
# |
Oct 5th 2016, 18:09 |
lorenzo |
since fixtures are run inside a transaction, then the rest of the fixtures are aborted until the transaction is closed |
# |
Oct 5th 2016, 18:09 |
lorenzo |
it means that one of your fixtures has an error @dereuromark |
# |
Oct 5th 2016, 18:08 |
NeoThermic |
lets give that a try then |
# |
Oct 5th 2016, 18:08 |
dereuromark |
@lorenzo The tests for posgres in https://github.com/dereuromark/CakePHP-DatabaseLog/pulls |
# |
Oct 5th 2016, 18:08 |
dereuromark |
there are tuts |
# |
Oct 5th 2016, 18:08 |
dereuromark |
via git bash that is easy, with git rebase -i |
# |
Oct 5th 2016, 18:07 |
NeoThermic |
dereuromark: I have no idea how to squash commits. I do know that github's UI allows you to squash the commits before you merge the branch in with the big green button |
# |
Oct 5th 2016, 17:56 |
keith |
The training on the 19th of October, is it possible to buy the recording, Iâ??ll be on a flight during the actual time? |
# |
Oct 5th 2016, 17:49 |
lorenzo |
can you please link again to the problem? |
# |
Oct 5th 2016, 17:49 |
lorenzo |
no, I was at a conference and I could barely use internet |