Mark
April 29, 2021, 10:50pm
1
I found tutorial
Does slim support Action (all in one) , for example, all about user will be in one class.
Action
class User
– create user
– raed user
– update user
– delete user
?
Second question
How to create database transaction with two or more queries?
odan
April 30, 2021, 7:34am
2
Hi @Mark
Does slim support Action (all in one) , for example, all about user will be in one class.
This will be supported in Slim 4.8. See here .
How to create database transaction with two or more queries?
Please add more details. What database abstraction layer are you using?
PDO provides the beginTransaction , commit and rollBack methods for handling transactions.
Mark
April 30, 2021, 7:49am
3
Can you add one example?
Mysql and Postgresql Pdo.
I need one example.
odan
April 30, 2021, 11:43am
4
Mark:
I need one example.
That’s why I added the 2 links. See above.
Mark
April 30, 2021, 12:43pm
5
When will be slim 4.8 available for install over composer?
Do I need use your selective library?
I ask for example for transaction in slim.
odan
April 30, 2021, 2:59pm
6
When will be slim 4.8 available for install over composer?
I don’t know. Maybe @l0gicgate knows more?
Do I need use your selective library?
Not sure what library you mean. Please add more details to your question.
I ask for example for transaction in slim.
Slim is a micro-framework and has no built-in database / transaction component. So there is no Slim specific example. You can use PDO directly or any QueryBuilder or ORM.
Mark
June 6, 2021, 3:37pm
7
@odan
Can you update your tutorial for slim 4.8, and example for all action in one controller?
slimphp:4.x
← ddrv-fork:array-routes
opened 03:38PM - 17 Apr 21 UTC
These changes will allow the route handler to be specified as an array. This all… ows you to open the handler method in PhPStorm in ctrl + click, and also allows you to avoid the "unused method" type of bindings.
For example:
```php
<?php
$app->get('/', [App\Controllers\PageController::class, 'home'])->setName('home');
```
About your book, will be updated with new features?
Thank you
odan
June 7, 2021, 8:32am
8
Hi Mark
I don’t think so, because in my personal opinion Single Action Controllers are the way to go and I highly recommend that.
But this does not mean that you can use other types of controllers, handlers, etc
1 Like
Mark
June 7, 2021, 3:18pm
9
Thank you @odan
And what is the better?
Write app in modules, e.g. modul user in one subfolders with action, data, domain, repository or all classes puts in each folder.
User
– action
– data
News
– action
– data
Or
Action
– usercreate
– useurpdate
– userread
– newsread
Etc…
odan
June 8, 2021, 7:09am
10
I have written a lot about this topic in my Blog and eBook.
You can find more information here:
1 Like