Bug #34018

Annotation with a numeric value is not correctly generated

Added by Georg Großberger over 9 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Must have
Category:
Object
Start date:
2012-02-16
Due date:
% Done:

0%

Estimated time:
PHP Version:
Has patch:
No
Complexity:
easy

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
[Syntax Error] 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.


Files

issue_34018p1.diff (553 Bytes) issue_34018p1.diff Georg Großberger, 2012-02-16 20:49

Related issues

Is duplicate of TYPO3.Flow - Bug #33932: AOP Proxy Compiler does not handle numeric annotation parametersResolvedKarsten Dambekalns2012-02-15

Actions
#1

Updated by Georg Großberger over 9 years ago

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 9 years ago

  • Status changed from New to Closed
  • Assignee set to Karsten Dambekalns
  • Target version set to 1.0.4

This is a duplicate of #33932 and a fix is under review at https://review.typo3.org/9125

Also available in: Atom PDF