Comments (10)
@mablae You can check if the Symfony\Component\Validator\Context\ExecutionContextInterface
interface does exist (which was introduced in Symfony 2.5):
if (interface_exists('Symfony\Component\Validator\Context\ExecutionContextInterface')) {
// Symfony 2.5 or higher
} else {
// Symfony before 2.5
}
from phone-number-bundle.
I've prepared a PR to fix this issue. I had to adapt the code to work both for Symfony < 2.5
and Symfony 2.5+
. Raising the requirements of Symfony to at least 2.7
which is LTS would help with future tickets too and would make life easier because we could simplify some parts of the code that are now a real mess, e.g. the unit tests that have to handle different ExecutionContext
classes (I don't remember in which version it was added but I know that there is now a documented trait to use for the unit tests of a validator that should handle all cases).
from phone-number-bundle.
ping @rh389 can we please move forward on this if it's still valid?
from phone-number-bundle.
The bundle supports versions before 2.5 (ie 2.3) so can't use buildViolation()
yet. Future versions can do.
Regarding the path, this sounds like #19.
from phone-number-bundle.
@thewilkybarkid You could do the buildValidation()
call conditionally (depending on the installed version of the Validator component).
from phone-number-bundle.
@thewilkybarkid ok i understand, you are right. Then the idea of xabbuh could be a solution.
Or you could maybe then replace addViolation
with addViolationAt
and do so:
private function addViolation($value, Constraint $constraint)
{
$this->context->addViolationAt(
$constraint->atPath,
$constraint->message,
array('{{ type }}' => $constraint->type, '{{ value }}' => $value)
);
}
It would be really nice if you would give an option to decide where the violation message should appear.
from phone-number-bundle.
@thewilkybarkid What's about a master-branch for Symfony 2.7+, 2.8+ or 3.0+ and a current stable branch for the current code? Then you could use these new features.
from phone-number-bundle.
Interesting. @xabbuh can you give an example how such a version check would be done proplery?
from phone-number-bundle.
ping @thewilkybarkid any news on this? PR is ready to be reviewed
from phone-number-bundle.
#108 is now merged, so closing this.
from phone-number-bundle.
Related Issues (20)
- Exception on form rendering when using Synfony 4 build-in Bootstrap 4 form support HOT 3
- PhoneNumberType is overriding template for Symfony TelType HOT 1
- Extensions Are Silently Dropped HOT 4
- Missing phone_number_parse Twig filter
- JMS Serializer: return empty phoneNumber: [] HOT 3
- Support `default_region` for `PhoneNumberType` with option `'widget' => PhoneNumberType::WIDGET_COUNTRY_CHOICE`
- Pulling in misd/phone-number-bundle with composer is causing memory limit to be exhausted
- How to deal with numbers saved before phone-number-bundle implementation?
- Country choice custom text
- My form submission is always invalid HOT 3
- Missing require in composer HOT 2
- New release HOT 4
- Symfony templating component required HOT 2
- PhoneNumberValidatorTest fails on CI HOT 1
- Deprecations from Twig
- Allow multiple type HOT 2
- Add support for symfony 4.4 HOT 3
- Abandoned in favour of `odolbeau/phone-number-bundle` HOT 8
- Regular Expression Issue for Iranian Mobile
- Is this bundle abandoned? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phone-number-bundle.