# |
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 :( |
# |
Jul 12th 2019, 15:03 |
ricksaccous |
i'm having another routes issue now though, and route issues are my least favorite |
# |
Jul 12th 2019, 15:02 |
ricksaccous |
meh |
# |
Jul 12th 2019, 15:02 |
ricksaccous |
probably |
# |
Jul 12th 2019, 15:02 |
ricksaccous |
honestly i'd just not use unauthorizedredirect and put the redirects in the log in method itself |
# |
Jul 12th 2019, 15:01 |
neon1024 |
Could be! |
# |
Jul 12th 2019, 15:01 |
neon1024 |
@ndm Redirect before login? :thinking_face: |
# |
Jul 12th 2019, 15:01 |
ricksaccous |
cheers m8 |
# |
Jul 12th 2019, 15:01 |
neon1024 |
One for Monday! Have a super weekend everyone |
# |
Jul 12th 2019, 15:01 |
ndm |
Probably because the redirect happens before your method/action is being invoked... |
# |
Jul 12th 2019, 14:58 |
neon1024 |
Why can’t I use `$this->Auth->setConfig('unauthorizedRedirect', ['prefix' => false, 'controller' => 'Dashboards', 'action' => 'home']);` in my login method to set the redirect per role? |
# |
Jul 12th 2019, 14:50 |
waspinator |
I've tried both and `"Policy for `App\\Model\\Table\\UsersTable` has not been defined.` |
# |
Jul 12th 2019, 14:49 |
waspinator |
What is the naming convention for policy files? Do you use plural or single? |
# |
Jul 12th 2019, 14:05 |
ricksaccous |
good luck |
# |
Jul 12th 2019, 14:04 |
jeremy.payne |
Trying to avoid that mess with the port :) |
# |
Jul 12th 2019, 14:03 |
jeremy.payne |
In the cake2 app they have all the multi-tenant code in folders and a symbolic link and a weird custom autoloader to force it to look into the symlink |
# |
Jul 12th 2019, 14:03 |
jeremy.payne |
But yeah, definitively an interesting setup and complicated code base that has suffered from feature bloat from people who didn't have much experience in engineering big apps. |
# |
Jul 12th 2019, 14:01 |
ricksaccous |
hehe |
# |
Jul 12th 2019, 14:01 |
ricksaccous |
oh, maybe that isn't so bad after all i suppose |
# |
Jul 12th 2019, 14:01 |
jeremy.payne |
I've been hired to port a cake2 to cake3 with no experience in either so it's a fun trying to fix weird architecture choices done :slightly_smiling_face: |
# |
Jul 12th 2019, 14:01 |
ricksaccous |
so each country has their own db? |
# |
Jul 12th 2019, 14:00 |
ricksaccous |
wow, sounds like a tricky set up nonetheless |
# |
Jul 12th 2019, 13:59 |
jeremy.payne |
There are BaseComponents and the tenant code just extends some bits and pieces |
# |
Jul 12th 2019, 13:59 |
jeremy.payne |
No we have one code base for a website running for several countries, where each country is run on a separate server |