# |
Jun 28th 2017, 14:47 |
jeremyharris |
$this->request->getParam(‘prefix’) === ‘admin’ |
# |
Jun 28th 2017, 14:47 |
jarard |
what is the easiest way to check for admin prefix? |
# |
Jun 28th 2017, 14:47 |
jeremyharris |
if it’s an either-or situation |
# |
Jun 28th 2017, 14:46 |
jeremyharris |
you’ll need a rule that checks it in name as well |
# |
Jun 28th 2017, 14:46 |
jeremyharris |
you can check the “context” in that case |
# |
Jun 28th 2017, 14:46 |
chris-andre |
But damn. I will allow it empty, but either name or organization_number has to be filled. |
# |
Jun 28th 2017, 14:45 |
jeremyharris |
requirePresence would make it fail with no key defined |
# |
Jun 28th 2017, 14:45 |
jeremyharris |
bingo |
# |
Jun 28th 2017, 14:45 |
chris-andre |
Ah... There is nothing to validate! |
# |
Jun 28th 2017, 14:44 |
chris-andre |
Right. Here it is: https://gist.github.com/chris-andre/4e6d9bda6d671feb3a529654b931fe05#file-result-txt |
# |
Jun 28th 2017, 14:43 |
jeremyharris |
yeah heheh |
# |
Jun 28th 2017, 14:43 |
jeremyharris |
sorry, I meant the actual result entity |
# |
Jun 28th 2017, 14:43 |
chris-andre |
Or do you mean the object? :P |
# |
Jun 28th 2017, 14:43 |
chris-andre |
Here is entity https://gist.github.com/chris-andre/4e6d9bda6d671feb3a529654b931fe05#file-customer-php |
# |
Jun 28th 2017, 14:43 |
chris-andre |
In formhelper I use `'validate' => 'new'`, in action I use `'validator' => 'new'` |
# |
Jun 28th 2017, 14:42 |
jeremyharris |
@chris-andre can you gist the entity too? I’d like to see what data it’s getting |
# |
Jun 28th 2017, 14:42 |
jarard |
admin/Properties = index, view |
# |
Jun 28th 2017, 14:42 |
jeremyharris |
great! |
# |
Jun 28th 2017, 14:42 |
chris-andre |
https://gist.github.com/chris-andre/4e6d9bda6d671feb3a529654b931fe05#file-customerstable-php-L46 |
# |
Jun 28th 2017, 14:42 |
jarard |
it's ok I found the solution in the plugin readme :) |
# |
Jun 28th 2017, 14:41 |
jeremyharris |
right, you said “validation is triggered” I just want to make sure it’s using the proper profile |
# |
Jun 28th 2017, 14:41 |
chris-andre |
validationNew() is the validation set for new records created in CustomersController's add action. |
# |
Jun 28th 2017, 14:41 |
jeremyharris |
just a guess |
# |
Jun 28th 2017, 14:41 |
jeremyharris |
maybe Admin.Properties = index, view |
# |
Jun 28th 2017, 14:41 |
jarard |
likely it would seem |
# |
Jun 28th 2017, 14:40 |
jeremyharris |
jarard oh I don’t know tiny auth. Perhaps you need to specify rules for the admin prefix too? |
# |
Jun 28th 2017, 14:40 |
jeremyharris |
@chris-andre validationNew specifically is? |
# |
Jun 28th 2017, 14:40 |
jarard |
I am using TinyAuth and I have the line: Properties = index, view |
# |
Jun 28th 2017, 14:39 |
chris-andre |
validation is triggered, the rule method is not |
# |
Jun 28th 2017, 14:39 |
jeremyharris |
jarard I’m not seeing where it’s allowed. is it in a parent method? |
# |
Jun 28th 2017, 14:38 |
jeremyharris |
@chris-andre are you sure the method is being triggered? what’s the entity look like? |
# |
Jun 28th 2017, 14:38 |
jarard |
sure: https://gist.github.com/spacebiscuit/23245d03e1490c3e33e08981b6429e8a |
# |
Jun 28th 2017, 14:37 |
jeremyharris |
jarard and your PropertiesController in the Admin namespace is allowed? can you gist it? |
# |
Jun 28th 2017, 14:36 |
chris-andre |
Does anyone understand why a my entity returns without any errors after this validation https://gist.github.com/chris-andre/4e6d9bda6d671feb3a529654b931fe05#file-customerstable-php-L22 ? |
# |
Jun 28th 2017, 14:35 |
jarard |
jeremyharris, I just followed the book, I added the configure write to bootstrap.php and the lines to routes.php |
# |
Jun 28th 2017, 14:34 |
jeremyharris |
jarard do you have some authorization that checks the prefix? |
# |
Jun 28th 2017, 14:17 |
jarard |
I don't have my users model prperly set up yet so can't actually login but I think I should still be able to access admin/properties |
# |
Jun 28th 2017, 14:17 |
jarard |
properties/index is an allowed action |
# |
Jun 28th 2017, 14:16 |
jarard |
I've added admin prefix routing to my project, but now I'm getting a re-direct to login when I brwose to admin/properties |
# |
Jun 28th 2017, 14:11 |
Leonardo_0112 |
right, i'll try create a composer package |
# |
Jun 28th 2017, 14:10 |
dereuromark |
copy and pasting into plugins dir also doesnt really get you any more updates easily then |