Skip to content

Commit

Permalink
Fixing returning null on uninitialized properties
Browse files Browse the repository at this point in the history
  • Loading branch information
mamazu committed May 3, 2019
1 parent 903be6b commit be77136
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Traits/ProductCustomerOptionCapableTrait.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types=1);
declare (strict_types = 1);

namespace Brille24\SyliusCustomerOptionsPlugin\Traits;

Expand Down Expand Up @@ -70,7 +70,8 @@ public function hasCustomerOptions(): bool
*/
public function getCustomerOptionValuePrices(): Collection
{
return $this->customerOptionValuePrices;
// We can not rely on the prices being set because Doctrine doesn't call the constructor for loaded entited
return $this->customerOptionValuePrices ?? new ArrayCollection();
}

/**
Expand Down

0 comments on commit be77136

Please sign in to comment.