Log message #4193058

# At Username Text
# Jul 14th 2019, 12:58 roberto.conterosito Hi, I'm trying to see errors associated to my "belongsToMany" rule. I've "Users, UsersRoles and Roles" tables. In the "UsersRolesTable" I've added new rule, isUnique, based on "role_id" and "user_id". When I try to save new users with duplicated role_id/user_id, save fails but $user->getErrors() is empty. I'm not able to understand how to retrieve belongsToMany entity errors.
# Jul 14th 2019, 12:36 roberto.conterosito Hi, did you solve this problem? I'm looking for a solution related to this issues. I'm not able to understand how to get errors from BTM. In details, I'm trying to get errors from "isUnique" role based on foreign keys fields.
# Jul 14th 2019, 09:33 ndm @mrfeedback If you want to output custom, non-view based content, then prepare and return a response instance. If you want to use views but invoke rendering manually, set `$this->autoRender = false;`, or return the response returned by `$this->render()`. https://book.cakephp.org/3.0/en/controllers/request-response.html#response https://book.cakephp.org/3.0/en/controllers.html#rendering-a-view
# Jul 14th 2019, 07:57 mrfeedback `$this->viewBuilder()->enableAutoLayout(false);` this still execpts an action template
# Jul 14th 2019, 07:47 mrfeedback it seems like i am blind. i do not find a reference on how to avoid rendering a template in a controller action. could me somebody please share the link
# Jul 14th 2019, 07:30 mrfeedback @niel.archer thanks. yeah i did then a similar approach. then i realized that data in table was encoded twice which then lead to strange results. by saying that -> i now need to convert data within the existing tables in order to obtain usable results
# Jul 13th 2019, 23:05 niel.archer i.e. create a new entry in your DataSources for latin1 and only use that connection for the tables affected
# Jul 13th 2019, 23:04 niel.archer @mrfeedback No idea about per table, but you could use a separate connection with the encoding set to what you need for that connection.
# Jul 13th 2019, 19:34 mrfeedback is there a way to define encoding per table? in my case my application accesses data from an older app which saved content in latin 1 when i get it with the new app it retrives it as utf8 which is broken. so i need to fetch it in latin1 i guess. now i want to fetch it in latin1 and then store it in utf8 in another table. any ideas?
# Jul 13th 2019, 03:33 bgrinter Hi - I'm trying to use the csvView and I've following the instructions in the readme but I'm getting `The layout file Layout/csv/default.ctp can not be found or does not exist` Added to routes.php `Router::extensions('csv');` Application.php ` $this->addPlugin('CsvView');`
# Jul 13th 2019, 03:07 challgren CakePHP 3.8.1 released!!! https://github.com/cakephp/cakephp/releases/tag/3.8.1
# Jul 12th 2019, 21:10 noel Are those current? I checked a few months ago and those training pages were all broken on the CakePHP site.
# Jul 12th 2019, 19:16 sjorgefabi How are the Cakephp training courses carried out? Do you have downloadable videos and subtitles?
# Jul 12th 2019, 17:06 admad @daniel.upshaw validation is already decoupled from models. It's even has its separate package https://github.com/cakephp/validation
# Jul 12th 2019, 16:49 ricksaccous @daniel.upshaw you can already use validators with arrays
# Jul 12th 2019, 16:11 daniel.upshaw Otherwise it's some untapped potential
# Jul 12th 2019, 16:11 daniel.upshaw I think it would be worth a refactor to decouple the validation elements from the models, keeping it API-compatible
# Jul 12th 2019, 16:06 daniel.upshaw Eg `(new Validator(['rule' => 'latitude']))->validate($inputVar)`
# Jul 12th 2019, 16:06 daniel.upshaw I know that there are built-in PHP functions like `filter_var` and other ways, but the Validator fundamental system should ideally be able to be used outside the context of models
# Jul 12th 2019, 16:02 daniel.upshaw Whoops, I had the wrong library there lol
# Jul 12th 2019, 15:59 daniel.upshaw There is the concept of "shapes"
# Jul 12th 2019, 15:58 daniel.upshaw Perhaps like `(new Validator(['rule' => 'int']))`
# Jul 12th 2019, 15:58 daniel.upshaw That's the `Validator` class constructor
# Jul 12th 2019, 15:57 slackebot 'required' => false, 'min' => false, 'max' => false, 'pattern' => false ]; $this->constraints = empty($constraints) ? self::$defaultConstraints : $constraints + $assumedFalseValues; }```
# Jul 12th 2019, 15:57 daniel.upshaw ``` /** * @param array $constraints Associative array of constraints to enforce. * Accepts the following keys: "required", "min", * "max", and "pattern". If a key is not * provided, the constraint will assume false. */ public function __construct(array $constraints = null) { static $assumedFalseValues = [
# Jul 12th 2019, 15:56 daniel.upshaw Should be interesting
# Jul 12th 2019, 15:56 daniel.upshaw I'm trying to construct the minimum amount of code to validate a variable using CakePHP methods
# Jul 12th 2019, 15:39 ricksaccous yeah i got routes ironed out a lot easier when i just stopped using resource routing, i didn't want all the magic in my case anyway
# Jul 12th 2019, 15:22 waspinator I was trying `bake policy UsersTable`
# Jul 12th 2019, 15:21 waspinator oh yeah, thanks
# Jul 12th 2019, 15:19 ndm Baking should work... like `bake policy --type=table Users`
# Jul 12th 2019, 15:15 waspinator I had to manually create a `UsersTablePolicy.php` to get things to work
# Jul 12th 2019, 15:12 ricksaccous it doesn't seem to be helping me
# Jul 12th 2019, 15:12 ricksaccous maybe i should ditch resource routing for this route
# Jul 12th 2019, 15:12 waspinator oh I see. I don't think bake supports tables yet
# Jul 12th 2019, 15:10 ndm @waspinator Depends on your resolver (configuration) https://book.cakephp.org/authorization/1.1/en/policy-resolvers.html
# Jul 12th 2019, 15:07 ricksaccous An Internal Error Has Occurred Error: A route matching "/api/hospitals/hospital_service_rates/edit/20/3/0.json" could not be found.
# Jul 12th 2019, 15:06 ricksaccous matching the current url
# Jul 12th 2019, 15:06 ricksaccous on the page i'm echoing the form it's not a problem, but when i actually ajax post to that url when i hit the url it is saying route not found
# Jul 12th 2019, 15:06 slackebot <ricksaccous>
# Jul 12th 2019, 15:04 ricksaccous especially since it was working a few seconds ago :(