Skip to content

Commit 7002cd6

Browse files
committed
note sure what was up with this one
1 parent 2ca1967 commit 7002cd6

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/Util/ClassSourceManipulator.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,20 @@ public function addEntityField(string $propertyName, array $columnOptions, array
9090
$typeHint = $this->getEntityTypeHint($columnOptions['type']);
9191
$nullable = $columnOptions['nullable'] ?? false;
9292
$isId = (bool) ($columnOptions['id'] ?? false);
93-
$comments[] = $this->buildAnnotationLine('@ORM\Column', $columnOptions);
93+
$attributes = [];
94+
95+
if ($this->useAttributesForDoctrineMapping) {
96+
$attributes[] = $this->buildAttributeNode('ORM\Column', $columnOptions);
97+
} else {
98+
$comments[] = $this->buildAnnotationLine('@ORM\Column', $columnOptions);
99+
}
94100

95101
$defaultValue = null;
96102
if ('array' === $typeHint) {
97103
$defaultValue = new Node\Expr\Array_([], ['kind' => Node\Expr\Array_::KIND_SHORT]);
98104
}
99105

100-
$this->addProperty(
101-
$propertyName,
102-
$comments,
103-
$defaultValue,
104-
[$this->buildAttributeNode('ORM\Column', $columnOptions)]
105-
);
106+
$this->addProperty($propertyName, $comments, $defaultValue, $attributes);
106107

107108
$this->addGetter(
108109
$propertyName,

0 commit comments

Comments
 (0)