Bug #34872

Singleton validators never have their options passed

Added by Karsten Dambekalns over 3 years ago. Updated over 2 years ago.

Status:Resolved Start date:2012-03-15
Priority:Must have Due date:
Assigned To:Adrian Föder % Done:

100%

Category:Validation
Target version:TYPO3 Flow Base Distribution - 2.0
PHP Version: Complexity:
Has patch:No Affected Flow version:FLOW3 1.0.3

Description

The ValidatorResolver does not pass options to validators that are singletons:

            case Configuration::SCOPE_PROTOTYPE:
                $validator = new $validatorObjectName($validatorOptions);
                break;
            case Configuration::SCOPE_SINGLETON:
                $validator = $this->objectManager->get($validatorObjectName);
                break;

Since singletons cannot get constructor arguments via get() but only through object configuration, we should at least check for options given to a singleton here and inform the developer about a probably bug in his code…

Associated revisions

Revision 5f1f59bd
Added by Adrian Föder over 2 years ago

[BUGFIX] Throw exception when using options with singleton validators

Validators being singleton must not be called with options because
the options are then inherent properties of the Validator and cannot
be executed subsequently with other options.

An exception is thrown if such a case occurs because it is then
a design mistake of the developer.

Besides, this improves the namespace use a bit.

Change-Id: I4a7dbaaaf8fa39a3f4677bb43db044a3231b843f
Releases: master, 2.0
Fixes: #34872

Revision 05fc389b
Added by Adrian Föder over 2 years ago

[BUGFIX] Throw exception when using options with singleton validators

Validators being singleton must not be called with options because
the options are then inherent properties of the Validator and cannot
be executed subsequently with other options.

An exception is thrown if such a case occurs because it is then
a design mistake of the developer.

Besides, this improves the namespace use a bit.

Change-Id: I4a7dbaaaf8fa39a3f4677bb43db044a3231b843f
Releases: master, 2.0
Fixes: #34872

History

#1 Updated by Karsten Dambekalns over 3 years ago

  • Target version changed from 1.0.4 to 1.0.5

#2 Updated by Karsten Dambekalns about 3 years ago

  • Target version changed from 1.0.5 to 1.1 RC1

#3 Updated by Karsten Dambekalns about 3 years ago

  • Status changed from Accepted to New
  • Assigned To deleted (Karsten Dambekalns)
  • Target version deleted (1.1 RC1)

#4 Updated by Karsten Dambekalns over 2 years ago

  • Subject changed from Singleton validators do not get their options to Singleton validators have never passed their options

#5 Updated by Karsten Dambekalns over 2 years ago

  • Subject changed from Singleton validators have never passed their options to Singleton validators never have their options passed

#6 Updated by Adrian Föder over 2 years ago

  • Status changed from New to Accepted
  • Assigned To set to Adrian Föder
  • Target version set to 2.0
  • Affected Flow version changed from FLOW3 1.0.3 to Git master

#7 Updated by Karsten Dambekalns over 2 years ago

Why did you change the affected version?

#8 Updated by Gerrit Code Review over 2 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/17671

#9 Updated by Adrian Föder over 2 years ago

  • Affected Flow version changed from Git master to FLOW3 1.0.3

sorry didn't want to change it but was used to click "git any" at that box, without reading a present value...

#10 Updated by Gerrit Code Review over 2 years ago

Patch set 2 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/17671

#11 Updated by Gerrit Code Review over 2 years ago

Patch set 1 for branch 2.0 has been pushed to the review server.
It is available at https://review.typo3.org/19562

#12 Updated by Adrian Föder over 2 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF