Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Key with Route Params #46

Open
miquellaboria opened this issue May 18, 2019 · 6 comments
Open

Use Key with Route Params #46

miquellaboria opened this issue May 18, 2019 · 6 comments

Comments

@miquellaboria
Copy link

How can I use Key with Route Params:

$app->delete('/group/{groupId}/access/{userId}', '\App\Controller\Group:removeUser')
->add(new \App\Lib\Validation(array(
v::oneOf(
v::key('groupId',v::IsPublicationOwner($container)),
v::key('userId', v::ItsMe($container))
)
)));

Returns:

At least one of these rules must pass for null
Key groupId must be present
Key userId must be present

@miquellaboria miquellaboria changed the title User Key with Route Params Use Key with Route Params May 18, 2019
@DavidePastore
Copy link
Owner

Hi @miquellaboria . What are you trying to do here? Do you want validation for both or only one of them?

@miquellaboria
Copy link
Author

Hi @DavidePastore I want to validate at least one of them.

Thanks!

@DavidePastore
Copy link
Owner

@miquellaboria This is a nice use case. Can you please check if #40 fixes it and make it works as expected?

@miquellaboria
Copy link
Author

@DavidePastore I have the same validation error: At least one of these rules must pass for null\nKey groupId must be present\nKey userId must be present

Key are not found :(

@alissonbezerra
Copy link

Hi, this #40 worked here. Here's my code:

$app->get('/cliente', ClienteController::class . ':listarClientes')->add(new \DavidePastore\Slim\Validation\Validation( v::oneOf( v::key('test', v::notBlank()), v::key('test2', v::notBlank()) ) ));

@DavidePastore
Copy link
Owner

@miquellaboria I expected that it worked as @alissonbezerra said. Let's investigate it. What is the definition of \App\Lib\Validation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants