Feature #44157
Object configuration should imply annotated object name
Status: | Resolved | Start date: | 2012-12-20 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Adrian Föder | % Done: | 100% |
|
Category: | Object | |||
Target version: | - | |||
PHP Version: | Complexity: | |||
Has patch: | No |
Description
consider the following use case:
1/** 2 * @Flow\Scope("singleton") 3 */ 4class FooService { 5 6 /** 7 * @var \TYPO3\Flow\Monitor\FileMonitor 8 */ 9 protected $fileMonitor; 10}
1Acme\Acme\FooService: 2 properties: 3 fileMonitor: 4 object: 5# name: TYPO3\Flow\Monitor\FileMonitor 6 arguments: 7 1: 8 value: 'MyPackage_MonitorIdentifier'
When running this way, Flow complains
Uncaught Exception Object configuration for property "fileMonitor" contains neither object name nor factory object name in configuration of package ...
So, the commented line in the yaml above becomes necessary, however I think the default object name in this case should still be the annotated one.
Do you agree on this?
Associated revisions
[FEATURE] ObjectConfiguration gets name from annotation
Currently, an object configuration's property's class must
explicitly configured with its name, even if the name is
implied by the annotation of the intended property.
This change falls back to that annotated class name, if
the name is not explicitly mentioned. For example, this
configuration now will work::
'Acme\Acme\SomeClass':
properties:
'someProperty':
object:
# the type of 'someProperty' will be inferred from the var annotation now
# previously it had to be specified via `name`
arguments:
1:
value: 'SomeConstructorArgument'
…as long as the mentioned property ``someProperty`` has a
proper ``@var`` annotation revealing the class name.
Change-Id: Ic84f2605856b43aab04672da4b75b3bc36b5e196
Resolves: #44157
Releases: master
History
#1 Updated by Rafael Kähm over 2 years ago
good idea, minus one "source of error" for developers by multiple definition of the same property.
But be carefully with interfaces and abstract classes, so row 5 in your yaml should be optional.
#2 Updated by Adrian Föder over 2 years ago
- Status changed from New to Under Review
- Assigned To set to Adrian Föder
Review at https://review.typo3.org/#/c/17255/
#3 Updated by Gerrit Code Review 12 months ago
Patch set 3 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at http://review.typo3.org/17255
#4 Updated by Gerrit Code Review 6 months ago
Patch set 4 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at http://review.typo3.org/17255
#5 Updated by Gerrit Code Review 6 months ago
Patch set 5 for branch master of project Packages/TYPO3.Flow has been pushed to the review server.
It is available at http://review.typo3.org/17255
#6 Updated by Adrian Föder 6 months ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset f0bde21d8d35b4751e22ad4eb1a087069f9c922b.