Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

update mapping for pricing set and elements

  • Loading branch information...
commit b366385f57d1b91711f89aab9d4bba01ebe92674 1 parent 85b3b86
@iampersistent iampersistent authored
View
13 lib/ImmersiveLabs/Pricing/Entity/PricingElement.php
@@ -3,6 +3,7 @@
namespace ImmersiveLabs\Pricing\Entity;
use Vespolina\Entity\Pricing\PricingElementInterface;
+use Vespolina\Entity\Pricing\PricingSetInterface;
use Vespolina\Exception\FunctionNotSupportedException;
class PricingElement implements PricingElementInterface
@@ -66,4 +67,16 @@ public function getId()
{
return $this->id;
}
+
+ public function setPricingSet(PricingSetInterface $pricingSet)
+ {
+ $this->pricingSet = $pricingSet;
+
+ return $this;
+ }
+
+ public function getPricingSet()
+ {
+ return $this->pricingSet;
+ }
}
View
3  lib/ImmersiveLabs/Pricing/Entity/PricingSet.php
@@ -31,7 +31,7 @@ public function __construct(array $customReturns = array())
}
$this->pricingElements = new ArrayCollection();
- $this->pricingElements->add(new TotalValueElement());
+ $this->addPricingElement(new TotalValueElement());
}
public function getId()
@@ -129,6 +129,7 @@ public function getContext()
public function addPricingElement(PricingElementInterface $element)
{
$this->pricingElements->add($element);
+ $element->setPricingSet($this);
return $this;
}
View
2  lib/ImmersiveLabs/Pricing/Mapping/Entity.PricingElement.orm.yml
@@ -26,5 +26,5 @@ ImmersiveLabs\Pricing\Entity\PricingElement:
name: "element_type"
manyToOne:
pricingSet:
- targetEntity: Vespolina\Entity\Pricing\PricingSetInterface
+ targetEntity: ImmersiveLabs\Pricing\Entity\PricingSet
inversedBy: pricingElements
View
4 lib/ImmersiveLabs/Pricing/Mapping/Entity.PricingSet.orm.yml
@@ -15,6 +15,6 @@ ImmersiveLabs\Pricing\Entity\PricingSet:
nullable: true
oneToMany:
pricingElements:
- targetEntity: Vespolina\Entity\Pricing\PricingElementInterface
+ targetEntity: ImmersiveLabs\Pricing\Entity\PricingElement
mappedBy: pricingSet
- cascade: [ "persist", "remove" ]
+ cascade: ["persist", "remove"]
Please sign in to comment.
Something went wrong with that request. Please try again.