Bug #34018
Annotation with a numeric value is not correctly generated
Status: | Closed | Start date: | 2012-02-16 | |
---|---|---|---|---|
Priority: | Must have | Due date: | ||
Assigned To: | Karsten Dambekalns | % Done: | 0% |
|
Category: | Object | |||
Target version: | TYPO3 Flow Base Distribution - 1.0.4 | |||
PHP Version: | Complexity: | easy | ||
Has patch: | No | Affected Flow version: | Git 1.0 |
Description
I have a domain model declared abstract with the following annotation:
* @ORM\InheritanceType("SINGLE_TABLE") * @ORM\DiscriminatorColumn(name="location_type", type="string", length=10)
When running a new request I got an exception from Doctrine with the message
Expected PlainValue but found ')' ...
After some digging I found the problem: TYPO3\FLOW3\Object\Proxy\Compiler::renderAnnotation recreated the annotation, messing up the "length" property. In the proxy, Doctrine tries to parse, the annotation was turned into:
* @\Doctrine\ORM\Mapping\InheritanceType("SINGLE_TABLE") * @\Doctrine\ORM\Mapping\DiscriminatorColumn(name="location_type", type="string", length=)
The problem is, that scalar values are only added if they are strings or boolean.
Adding a
} elseif (is_scalar($optionValue)) { $optionValueAsString = (string) $optionValue; }
after the "elseif (is_array($optionValue))", solved the problem.
Related issues
History
#1 Updated by Georg Großberger over 3 years ago
- File issue_34018p1.diff added
Patch for the above - suggested - solution.
Tried to add a test in CompilerTest.php, but they are all using the Validate object, which has no numeric argument, and the DiscriminatorColumn class is empty.
If you know how to add a clean test, please tell me and I'll be glad to add one and push this to gerrit.
#2 Updated by Karsten Dambekalns over 3 years ago
- Status changed from New to Closed
- Assigned To set to Karsten Dambekalns
- Target version set to 1.0.4
- Affected Flow version changed from Git master to Git 1.0
This is a duplicate of #33932 and a fix is under review at https://review.typo3.org/9125