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

Is there a method overwriting $_POST? #107

Open
circle8z opened this issue Feb 1, 2016 · 5 comments
Open

Is there a method overwriting $_POST? #107

circle8z opened this issue Feb 1, 2016 · 5 comments

Comments

@circle8z
Copy link
Contributor

circle8z commented Feb 1, 2016

After checking if the request failed to pass validation,
I want to use the filtered values as the form's values.
Example:

$filteredValues = $this->validation->getValues();
$this->request->setPost($filteredValues);
@mruz
Copy link
Member

mruz commented Feb 1, 2016

You can use replace() or setData(), because request's post is an Arr.

$this->request->getPost()->replace($this->validation->getValues());

Remember that this not overwrite the _POST due to zephir-lang/zephir#203, so after replace:

$_POST['username']; // still original
$this->request->getPost('username'); // filtered

@mruz mruz added the help label Feb 1, 2016
@circle8z
Copy link
Contributor Author

circle8z commented Feb 2, 2016

Your advice was helpful. Thank you very much!!

@mruz mruz added the discussion label Mar 6, 2016
@mruz
Copy link
Member

mruz commented Mar 6, 2016

Is it _POST overwriting required in the future? What do you think?

@circle8z
Copy link
Contributor Author

I thought that I need to use _POST overwriting, because Ice\Tag class use _POST.
The issue will probably be solved by the following example. What do you think?

$this->request->getPost()->replace($this->validation->getValues());
$this->tag->setValues($this->requrest->getPost());

@mruz
Copy link
Member

mruz commented Mar 10, 2016

Yes, you can set values:

$this->tag->setValues($this->requrest->getPost()->getData());

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

2 participants