Skip to content

Commit 44cc80a

Browse files
committed
Fix ArrayCollection usage
1 parent 0fd8d32 commit 44cc80a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

templates/class.php.twig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ use {{ use }};
2020
{% endfor %}
2121
*/
2222
{% if class.abstract %}abstract {% endif %}class {{ class.name }}{% if class.parent %} extends {{ class.parent }}{% endif %}{% if class.interfaceName %} implements {{ class.interfaceName }}{% endif %}
23+
2324
{
2425
{% for constant in class.constants %}
2526
/**
@@ -36,7 +37,7 @@ use {{ use }};
3637
* {{ annotation }}
3738
{% endfor %}
3839
*/
39-
{{ config.fieldVisibility }} ${{ field.name }}{% if field.isArray and (field.isEnum or not field.typeHint or not config.useDoctrineCollection) %} = []{% endif %};
40+
{{ config.fieldVisibility }} ${{ field.name }}{% if field.isArray and (field.isEnum or not field.typeHint or not config.doctrine.useCollection) %} = []{% endif %};
4041
{% endfor %}
4142
4243
{% if config.doctrine.useCollection and class.hasConstructor %}
@@ -45,7 +46,7 @@ use {{ use }};
4546
parent::__construct();
4647
4748
{% for field in class.fields %}
48-
{% if field.isArray and field.typeHint and not field.isEnum %}
49+
{% if config.doctrine.useCollection and field.isArray and field.typeHint and not field.isEnum %}
4950
$this->{{ field.name }} = new ArrayCollection();
5051
{% endif %}
5152
{% endfor %}

0 commit comments

Comments
 (0)