Commit Graph

276 Commits

Author SHA1 Message Date
Fabien Potencier
1aabc5da64 fixed CS 2011-06-08 12:16:48 +02:00
Fabien Potencier
62e4342a86 fixed CS 2011-06-08 12:12:55 +02:00
Fabien Potencier
65200aa86a added missing license headers 2011-05-31 10:57:06 +02:00
Fabien Potencier
699ecfcf90 Merge remote branch 'stloyd/validators_refactoring'
* stloyd/validators_refactoring:
  Refactor validators constraints: - remove need for defining "getTargets()" method as 95% of validators use same one - replace abstract "Constraint::getTargets()" with one that use 95% of validators - add additional tests for "Constraint::getTargets()" method - remove unused "use" statement in Constraint\Valid
2011-05-26 14:58:24 +02:00
Fabien Potencier
66064cc8fc fixed CS 2011-05-25 11:35:29 +02:00
stloyd
db28beb395 Simplify RegexValidator 2011-05-25 11:08:13 +02:00
stloyd
3ea2a32c53 Refactor validators constraints:
- remove need for defining "getTargets()" method as 95% of validators use same one
- replace abstract "Constraint::getTargets()" with one that use 95% of validators
- add additional tests for "Constraint::getTargets()" method
- remove unused "use" statement in Constraint\Valid
2011-05-25 10:51:35 +02:00
Fabien Potencier
465be3d94c Merge remote branch 'jdhoek/patch-3'
* jdhoek/patch-3:
  Add {} around @inheritDoc.
2011-05-24 09:53:10 +02:00
jdhoek
42d33489c5 Add {} around @inheritDoc. 2011-05-24 00:36:03 -07:00
jdhoek
cda87bef23 Add {} around @inheritDoc 2011-05-24 00:33:56 -07:00
Johannes Schmitt
6c0b0449a6 Merge remote branch 'origin/master' into annotations
Conflicts:
	UPDATE.md
	src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
	src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
2011-05-19 22:49:59 +02:00
Johannes Schmitt
42fb34b647 fixed tests 2011-05-19 22:46:34 +02:00
Fabien Potencier
9fe1c3ae0e Merge remote branch 'bschussek/form'
* bschussek/form: (22 commits)
  Fix merge error (function "guess" was in there twice)
  [Form] Added test case for bf2f9d2a02
  [Form] Form::isBound() and Form::isValid() work correctly now for read-only forms
  [Locale] Improved error reporting and added stubs for intl_is_failure(), intl_get_error_code() and intl_get_error_message()
  [Form] Implemented fix for 361c67f54f
  [Form] Add test for the handling of array values in the constraint violation
  [Form] Further simplified PropertyPath code
  [Form] Added test for 6c337d1cc0
  [Form] Removed unused option "pattern" of date and time type
  [Form] Renamed view variable "name" to "full_name"
  [Form] Renamed collection option "type_options" to "options" to be consistent with the repeated type
  [Form] CSRF documentation and a few CS changes
  [Form] Move CSRF options from types to the CSRF extension
  [Form] Added a search form field type
  [Form] Optimization of PropertyPath
  [Form] replace assertEquals by assertFalse, assertTrue, assertNull
  [Form] fix file permissions to 644 again ;)
  [Form] add tests for type_options in collectionType
  fix file permissions to 644
  [Form] add type_options for CollectionType to be abble to set options to type
  ...
2011-05-19 16:25:30 +02:00
Fabien Potencier
c4232b11fa Merge remote branch 'beberlei/DoctrineUniqueValidator'
* beberlei/DoctrineUniqueValidator:
  [Doctrine] Fix default value to null for entity manager to make fluent integration with Doctrine Registry work
  [Doctrine] Add fields as default option and allow strings to be passed.
  [Doctrine] Add DoctrineBundle integration (DI Container registration) for the UniqueEntityValidator
  [Doctrine] Implement suggested changes by Stof, added functional test to verify unique validator works.
  [Doctrine] Add Unique Validator
2011-05-19 15:38:20 +02:00
stealth35
61b23a5a68 checkdnsrr exits for all PHP 5.3 version 2011-05-19 05:21:53 -07:00
Bernhard Schussek
06f829ace5 [Form] Implemented fix for 361c67f54f 2011-05-18 23:51:39 +02:00
Benjamin Eberlei
cfc2471109 [Doctrine] Add Unique Validator 2011-05-17 23:04:13 +02:00
Fabien Potencier
1394183a68 Merge remote branch 'stloyd/patch-3'
* stloyd/patch-3:
  Fix for bug when using APC in version 3.1.4
2011-05-17 09:41:45 +02:00
Fabien Potencier
86a2d27da9 Merge remote branch 'stloyd/ipvalidator_fix'
* stloyd/ipvalidator_fix:
  Better comment about no test IP6 addresses for "FILTER_FLAG_NO_RES_RANGE"
  Refactoring of IpValidator to use native php filter extension, also adding additional flag support and test cover.
2011-05-17 09:25:04 +02:00
Johannes Schmitt
54ae90d36d some cleanups 2011-05-17 07:41:49 +02:00
Johannes Schmitt
796d9af0c4 some updates 2011-05-16 22:26:24 +02:00
Johannes Schmitt
8e5b11a226 Merge remote branch 'origin/master' into annotations 2011-05-15 18:35:25 +02:00
Fabien Potencier
d2525c9492 [Validator] fixed possible warning 2011-05-15 11:18:03 +02:00
Fabien Potencier
4ef13b6d5c added exceptions when APC is not enabled 2011-05-14 17:43:25 +02:00
Fabien Potencier
fe4515bde3 Merge remote branch 'stloyd/patch-2'
* stloyd/patch-2:
  Throw an exception when APC is not loaded but cache is enabled in app config
2011-05-14 17:38:41 +02:00
Fabien Potencier
9c1bdc6ca4 Merge remote branch 'mvrhov/metadata_defaultgroup_fix'
* mvrhov/metadata_defaultgroup_fix:
  If there is no namespace in classname the 1st character was stripped off
2011-05-14 17:25:51 +02:00
Fabien Potencier
e6766a3189 [Validator] fixed various bugs in previous merge 2011-05-14 17:18:23 +02:00
Johannes Schmitt
2d8afd8dd6 Merge remote branch 'origin/master' into annotations
Conflicts:
	src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
	src/Symfony/Bundle/FrameworkBundle/Resources/config/validator.xml
	src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
2011-05-14 12:51:05 +02:00
Joseph Bielawski
d235570653 Fix for bad regexp used in PHP <= 5.3.2. Closes #897 2011-05-14 03:43:46 -07:00
Bernhard Schussek
f801c398eb Merge remote branch 'francisbesset/validators_date_datime' into francis_merge
Conflicts:
	src/Symfony/Component/Validator/Constraints/DateTimeValidator.php
	src/Symfony/Component/Validator/Constraints/DateValidator.php
2011-05-13 17:09:54 +02:00
Miha Vrhovnik
cd7ab69a17 If there is no namespace in classname the 1st character was stripped off 2011-05-13 16:38:01 +02:00
Joseph Bielawski
23b34749f9 Fix for bug when using APC in version 3.1.4 2011-05-12 07:50:47 -07:00
Joseph Bielawski
ec3ea65819 Throw an exception when APC is not loaded but cache is enabled in app config 2011-05-12 07:44:22 -07:00
stloyd
5997b930a5 Refactoring of IpValidator to use native php filter extension, also adding additional flag support and test cover. 2011-05-11 13:19:03 +02:00
John Wards
d96e2c5d79 [Validator] Adding support for Closure in CallbackValidator
Usage:
$formBuilder = $this->get('form.factory')
            ->createBuilder('form');
$formBuilder->setAttribute('validation_constraint', new Callback(array("methods"=>array(
    'validate' => function ($data, $context) use ($elements) {
       // logic to add violations depending on the elements
    }
))));
2011-05-10 12:12:18 +01:00
Johannes Schmitt
f7e03f2d87 Merge remote branch 'origin/master' into annotations
Conflicts:
	UPDATE.md
	src/Symfony/Bundle/DoctrineBundle/Resources/config/orm.xml
	src/Symfony/Bundle/DoctrineBundle/Tests/DependencyInjection/AbstractDoctrineExtensionTest.php
2011-05-08 07:28:23 +02:00
Pascal Borreli
e60a68f2c6 [Validator] Fixing method_exists
see dea5b26c3f
2011-05-07 19:08:30 +00:00
Drew Butler
dea5b26c3f Method exists does not work if you append the () to the method name, thus this never words for objects that actually have the __toString method. Removed the erroneous () so that this works as it appears to have been intended. 2011-05-06 13:20:29 -07:00
Johannes Schmitt
7e26575bbd [FrameworkBundle] added framework-wide annotation reader, updated validator tests 2011-04-29 15:54:44 +02:00
Johannes Schmitt
d151d2d4b8 added Annotations library 2011-04-28 23:09:08 +02:00
Eriksen Costa
164ce5210d capitalized 'boolean' 2011-04-27 02:35:10 -03:00
Francis Besset
886149fa00 [Validator] Refactoring DateTimeValidator and DateValidator 2011-04-27 00:14:31 +02:00
Francis Besset
c6d39ed61f [Validator] Date: check if the value is a DateTime instance 2011-04-27 00:09:57 +02:00
Fabien Potencier
0ac679e73c Merge remote branch 'markchalloner/master'
* markchalloner/master:
  [Validator] Updated ContraintViolationList ArrayAccess setter to check equivalence to null instead of using is_null
  Implemented ArrayAccess interface
2011-04-26 15:34:47 +02:00
Fabien Potencier
889c422d6e Merge remote branch 'igorw/ipv6'
* igorw/ipv6:
  [HttpFoundation] minor optimization
  minor adjustments suggested by vicb
  [HttpFoundation] IPv6 support for RequestMatcher
  [HttpFoundation] refactor RequestMatcherTest to use dataProvider
  [Validator] use full iPv6 regex
  [Validator] add IPv6 support to UrlValidator
  [HttpFoundation] add IPv6 support to Request
  [HttpFoundation] test Request::create with an IP as host name
  [HttpFoundation] refactor Request::getClientIp test
2011-04-24 22:04:25 +02:00
Pascal Borreli
8c0beea677 [Phpdoc] Cleaning/fixing 2011-04-23 15:18:47 +00:00
Igor Wiedler
51d12758a0 minor adjustments suggested by vicb 2011-04-22 18:37:20 +02:00
Bernhard Schussek
54e66c518f [Form] Reorganized code into "form extensions"
The extension classes are now the only constructor argument of the FormFactory class. They replace the existing "type loader" classes.

    new FormFactory(array(
        new CoreExtension($validator, $storage),
        new CsrfExtension($csrfProvider),
        new DoctrineOrmExtension($em),
    ));

Together with a few upcoming commits this mechanism will make

 * extension of the form framework in bundles and
 * usage of the forms outside of Symfony2

much easier.
2011-04-22 17:41:21 +02:00
Igor Wiedler
e5b923a0ec [Validator] use full iPv6 regex
it was taken from:
https://github.com/strattg/ipv6-address-test/blob/master/Tests/Rfc3986RegexTest.php
2011-04-22 17:07:44 +02:00
Igor Wiedler
afcdbf8b79 [Validator] add IPv6 support to UrlValidator 2011-04-22 17:07:44 +02:00
Ryan Weaver
1856601524 [Validator] Modifying Choice message and adding a different multiple message 2011-04-21 20:05:13 -05:00
Kris Wallsmith
3ff157c8a5 [Validator] switched to apc_exists() 2011-04-06 04:12:29 -07:00
Kris Wallsmith
9ff2ca7f1d [Validator] fixed apc cache 2011-04-06 04:07:37 -07:00
Fabien Potencier
a9160eee70 [Validator] made fields the default option for Collection constraint 2011-03-31 15:36:04 +02:00
Fabien Potencier
16a98cf104 [Validator] added a Metadata factory that can be used with ValidatorInterface::validateValue() 2011-03-31 15:05:18 +02:00
Martin Hason
e21591e16e [Validator] fixed CS 2011-03-31 14:02:00 +02:00
Fabien Potencier
07838c9612 [FrameworkBundle] removed the possibility to change the method name for validation static method loader (as it would break third-party bundles) 2011-03-30 23:21:17 +02:00
Fabien Potencier
f92055ce42 [Validator] renamed methods that do not follow CS
requiredOptions -> getRequiredOptions
targets -> getTargets
defaultOption -> getDefaultOption
2011-03-30 23:18:20 +02:00
Fabien Potencier
525702b5c6 [Validator] renamed method to follow CS 2011-03-30 23:10:30 +02:00
Mark Challoner
1adbb763cb [Validator] Updated ContraintViolationList ArrayAccess setter to check equivalence to null instead of using is_null 2011-03-30 08:43:05 +01:00
Mark Challoner
77ae8b5898 Implemented ArrayAccess interface 2011-03-28 13:54:37 +01:00
Johannes M. Schmitt
7887f04dc2 removed Assert prefix from all constraints, renamed annotation namespace to assert 2011-03-26 15:26:05 +01:00
Bernhard Schussek
3e29348d21 [Validator] Added support for static callbacks to Callback constraint 2011-03-25 01:36:58 +01:00
Bernhard Schussek
9c6a6e13bf [Validator] Renamed Execute constraint to Callback 2011-03-25 01:34:35 +01:00
Fabien Potencier
539e0e4870 Merge remote branch 'mweimerskirch/master' 2011-03-14 14:38:00 +01:00
Fabien Potencier
8c423edfef replaced symfony-project.org by symfony.com 2011-03-06 12:40:06 +01:00
Pascal Borreli
65560b30e1 [Validator] Fixed Typo 2011-03-01 18:58:08 +01:00
Christophe Coevoet
92bfbf575c Fixed CS 2011-02-27 20:56:29 +01:00
Michel Weimerskirch
5f0d83662c Simplified EmailValidator using native PHP validation function. 2011-02-24 04:30:23 -08:00
Fabien Potencier
f54cedfe5e added LICENSE files for the subtree repositories 2011-02-22 18:58:15 +01:00
Bernhard Schussek
89dbb04c63 [Validator] Made method name shorter 2011-02-16 23:05:22 +01:00
Lukas Kahwe Smith
dd71501f54 some fixes by just "blindly" trying to make phpStorm code analysis happier 2011-02-04 19:30:28 +01:00
Bernhard Schussek
1a34743990 [Validator] Fixed: Collections annotated with @Valid may contain scalar values. These values are ignored by the GraphWalker 2011-02-03 13:21:37 +01:00
Bernhard Schussek
55a97ec78e [Validator] Made GraphWalker::validateReference() method public 2011-02-03 11:00:03 +01:00
Bernhard Schussek
5ed4d91bb8 [Validator] Implemented Execute constraint 2011-02-03 11:00:03 +01:00
Thomas
e6dc155e89 fix validator class metadata warning 2011-02-02 11:37:41 +01:00
Bernhard Schussek
0c3ca26e6e [Validator] Implemented traversing of \Traversable objects using the @Valid constraint. Can be disabled by setting the @Valid option 'traverse' to false 2011-01-28 09:19:32 +01:00
Fabien Pennequin
c392f2518d [Form][Validator] Fixed indentation 2011-01-26 10:36:10 +01:00
Ryan Weaver
17f9162b89 [Standards] Changing many instances of "boolean" to "Boolean". 2011-01-21 09:53:24 +01:00
Bernhard Schussek
d143eaad72 [Validator] Fixed XML schema 2011-01-19 16:50:45 +01:00
Bernhard Schussek
d327a90ff2 [Validator] Added namespace prefix support for XML and YAML loaders 2011-01-19 16:25:50 +01:00
Bernhard Schussek
2d7c47e488 [Validator] Each object is now only validated once for a given group 2011-01-19 16:25:50 +01:00
Bernhard Schussek
d52ae8e103 [Validator] Removed unused class GroupChain 2011-01-19 16:25:50 +01:00
Bernhard Schussek
eed3c9a48c [Validator] Added abstract method Constraint::targets() to define whether constraints can be put onto properties, classes or both 2011-01-19 16:25:50 +01:00
Bernhard Schussek
6ad22fd702 [Validator] Added ValidatorFactory for programmatically creating validators 2011-01-19 16:25:50 +01:00
Dominique Bongiraud
64fb94c725 normalized license messages in PHP files 2011-01-18 08:07:46 +01:00
Ryan Weaver
11085fd6a6 [Validator] Adding a significant amount of PHPDoc to the Validator component. 2011-01-16 07:40:15 +01:00
Bernhard Schussek
39c9bf160e [Validator] Implemented @Ip constraint 2011-01-03 22:07:15 +01:00
Bernhard Schussek
708c780213 [Validator] Renamed @Validation constraint to @Set 2011-01-03 22:06:52 +01:00
Bernhard Schussek
52ecffe51b [Validator] Implemented Locale constraint 2011-01-02 10:41:09 +01:00
Jordi Boggiano
094d428e68 CS: Unified strict equality comparisons, put var on the right side 2010-12-21 08:51:21 +01:00
Bernhard Schussek
a059ec891d [Validator] Implemented Image constraint 2010-12-16 10:18:33 +01:00
Bernhard Schussek
993257a83e [Validator] Implemented Language constraint 2010-12-16 10:18:33 +01:00
Bernhard Schussek
fdb7f84c7d [Locale][Form][Validator] Refactored code to new Locale component, implemented Country constraint 2010-12-16 10:18:33 +01:00
Fabien Potencier
48e30537c4 added exception when a loaded YAML resource is not an array 2010-12-12 08:39:37 +01:00
Johannes Schmitt
cc3a783890 removed dead code 2010-12-10 16:34:20 +01:00
Bernhard Schussek
1b2ca259f1 [Validator] Fixed string-based constraint validators to accept empty values 2010-12-10 14:28:11 +01:00
Gustavo Falco
af291bb0f1 [Validator] Fixed UrlValidator to accept empty strings (closes #9297) 2010-12-10 14:28:07 +01:00
pablodip
984a857a96 [Validator] fixed the static method loader to not repeat the loading when the static method is in the parent classes 2010-12-10 14:27:49 +01:00
Bernhard Schussek
68cebd667a [Validator] Group sequences must now always contain the group "<ClassName>" and never the group "Default" since that group is redefined by the group sequence 2010-11-19 07:11:26 +01:00
Bernhard Schussek
a71cad480a [Validator] Added @validation:GroupSequence to annotation driver 2010-11-19 07:11:23 +01:00
Jordi Boggiano
e69c5ae860 Coding style fixes 2010-11-18 07:00:03 +01:00
Bernhard Schussek
46145d8de7 [Validator] Fixed exception thrown in Valid constraint to be thrown only when the options are not empty 2010-11-17 10:55:48 +01:00
Bernhard Schussek
940ce9aedf [Validator] Group "Default" is now propagated to validated references when group sequences are validated
This conforms to JSR303 (see version 1.0 final, page 39).
2010-11-17 08:02:10 +01:00
Bernhard Schussek
6a148465da [Validator][Form] Removed support for match-all group "*"
The constraint "Valid" does not accept any options or groups anymore. As per
JSR303 1.0 final, section 3.5.1 "Object graph validation" (page 39),
properties  annotated with valid should be cascaded independent of the current
group (i.e. always). Thus the group "*" is not necessary anymore and was
removed from the "Valid" constraint in the Form validation.xml.
2010-11-17 08:02:06 +01:00
Bernhard Schussek
8df966f507 [Validator] Made class Constraint abstract because it must not be instantiated 2010-11-17 08:02:03 +01:00
Benjamin Eberlei
5aeb358721 [Validator] Made the namespace prefix for annotations configurable
Modified the framework bundle to use validation => Symfony\Component\Validator\Validator defaults.
Enhanced Framework Extension validator configuration to allow to extend this configuration with
user-specified annotations, for example:

    validation:
        enabled: true
        annotations:
            namespaces:
                myprojectvalidator: MyProject\Validator\

to register @myprojectvalidator:Validator(...)
2010-11-16 07:28:02 +01:00
jeff
69cd21d8be [Validator] Fixed annotation loader to not add parent constraints twice 2010-11-12 17:56:09 +01:00
ever.zet
4c340c5cc9 [Form] fixed forms grouped validation
Added ability to specify **match-all** validation group, which
constraints will runs on every specified validation group.
Added groups="*" option to `Form::data` Valid validator.
2010-11-12 17:53:17 +01:00
Kris Wallsmith
4a18624927 [Validator] removed ftp and ftps from default url protocols 2010-10-18 16:57:07 +02:00
pborreli
082090d880 [Validator] Fixed coding standard 2010-10-16 10:49:41 +02:00
Kris Wallsmith
5d4c80f27b [Validator] removed DependencyInjection integration 2010-10-16 08:34:36 +02:00
Fabien Potencier
0fc8906feb [Validator] forced all validation annotations to be in the validation namespace to avoid collisions, removed the need for the wrapping @Validation annotation
Before:

    /**
     * @Validation({@DateTime()})
     */

After:

    /**
     * @validation:DateTime()
     */

The @validation:Validation() construct is not needed anymore (it is still supported
as this is useful when you have several annotations with the same class).

So, the above is equivalent to:

    /**
     * @validation:Validation({@validation:DateTime()})
     */
2010-10-02 15:07:00 +02:00
Fabien Potencier
3a4d9cb185 [Validation] fixed license 2010-10-02 12:42:35 +02:00
Fabien Potencier
1a055fc7f0 [Validator] fixed typo 2010-09-30 07:21:54 +02:00
Fabien Potencier
3b1e83380b [Validator] removed the convention that error parameters are delimited with %% 2010-09-29 07:59:45 +02:00
Fabien Potencier
9580c74f0b [Validator] changed the convention for placeholders in messages to be compatible with Twig (from %limit% to {{ limit }}) 2010-09-27 09:46:56 +02:00
Fabien Potencier
866c306dc8 removed the message interpolator system in the Validator component (i18n management should be done globally, not in a specific component) 2010-09-24 16:41:28 +02:00
Jordi Boggiano
82f6a68eb2 [Validator] Allow DateTime objects as valid DateTimes 2010-09-22 09:16:26 +02:00
Jeremy Mikola
a86bac44ce [Validator] Remove leading '@' when validating email domain MX record 2010-09-10 20:42:22 +02:00
Fabien Potencier
a141c98917 [HttpFoundation] moved File Component into the HttpFoundation one 2010-09-09 17:01:48 +02:00
Fabien Potencier
fc9325a737 fixed file upload 2010-09-09 16:07:12 +02:00
Bulat Shakirzyanov
bb51e7cb26 [Validator] fixed Xliff loader to use forward slashes in file path 2010-09-09 08:01:46 +02:00
Fabien Potencier
4d669d106e [Validator] changed Xliff loader to get XSD locally 2010-09-07 14:30:50 +02:00
Fabien Potencier
dadfaa271f [Validator] fixed indentation 2010-09-07 14:18:00 +02:00
Fabien Potencier
bf82cf42dd renamed Symfony\Components to Symfony\Component 2010-08-20 23:09:55 +02:00