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

Add ushahidi/kohana-validation package and use that #1786

Merged
merged 1 commit into from
Jul 4, 2017

Conversation

rjmackay
Copy link
Contributor

@rjmackay rjmackay commented Jun 8, 2017

This replaces the dependencies on Kohana Core.

  • Update Validators to refer to namespaced Valid and Validation class
  • Fix DI for ValidationEngineTrait
  • Set up translations
  • Move error messages to laravel language files

Test checklist:

  • Check travis build runs with only failures in dataproviders

Refs #1372

Ping @ushahidi/platform

@rjmackay
Copy link
Contributor Author

rjmackay commented Jun 8, 2017

@willdoran can you review?
Validation package is over here: https://github.com/ushahidi/kohana-validation
I'm not super happy that I had to include the Arr helper but it was the fastest path to done.


public function getTranslationCallback()
{
return function ($file, $field, $error = null) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably the ugliest bit. We pass a callback into the KohanaValidation lib for translating messages, and do some wrangling here to connect that to lumen's translator.

@@ -27,8 +26,8 @@
* @param $validation_factory
* @return void
*/
public function setValidation(InstanceFactory $validation_factory)
public function setValidation(ValidationEngine $validation_engine)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this was set up so weirdly. Cleaner now

@rjmackay rjmackay force-pushed the lumen-separate-validation-from-kohana branch from a2a99a7 to e445c2d Compare July 3, 2017 03:39
@willdoran
Copy link
Contributor

@rjmackay This is to stablise validation during transition?

@rjmackay
Copy link
Contributor Author

rjmackay commented Jul 4, 2017

@rjmackay This is to stablise validation during transition?

Yup. We need to drop Kohana ASAP, so this just keeps the couple of classes we need in the interrim.

This replaces the dependencies on Kohana Core.

- Update Validators to refer to namespaced Valid and Validation class
- Fix DI for ValidationEngineTrait
- Set up translations
- Move error messages to laravel language files
@rjmackay rjmackay force-pushed the lumen-separate-validation-from-kohana branch from e445c2d to a0f3d2f Compare July 4, 2017 22:26
@rjmackay rjmackay merged commit 82454c1 into lumen Jul 4, 2017
@rjmackay rjmackay deleted the lumen-separate-validation-from-kohana branch July 4, 2017 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants