Conversation
| ->isEqualTo(1) | ||
| ->integer($modelFk->countWhere($where)) | ||
| ->isEqualTo(1) | ||
| ->object($model->truncate(true, false)) |
There was a problem hiding this comment.
I am not keen on myFunc(true, false) It would make more sense to me to have ->truncate("CASCADE AND MORE OPTIONS");
This IMHO let the developer with full control of future Pg extensions to the truncate command. The only issue I see is a security concern, it would imply to cut everything after a semicolon character to ensure a brain dead developer that passes truncate options from an external environment would still be safe.
There was a problem hiding this comment.
Another option can be instead of "true, false" use some constant or bit like `truncate(PG_TRUNCATE_CASCADE | PG_TRUNCATE_RESTART)
If any extension is added, a simple define can be added.
There was a problem hiding this comment.
I'm ok with you for postgres developer, but for beginner developer, it's less easy. If you want to use an other syntax for truncate you could be to use ->query('TRUNCATE ....'). For me, the SQL is the best language but for the rest of the world is not a sexy language.
it would be a shame not to help those developpers, no? I thinks our job is to help the rest of the world to discover all the postgresql functionalities :)
Postgresql developer keeps control of his actions and queries, and the junior developer is not afraid of sql
But I'm ok to change the method signature because bool is not a good practice
chanmix51
left a comment
There was a problem hiding this comment.
change the truncate method signature
#55