Permalink
Browse files

attribute interface back, and fixed item and orders

  • Loading branch information...
1 parent ffe8fcf commit 89f5f33c8a19d643a276b853e41fd6781e561d3e @theodorDiaconu theodorDiaconu committed with iampersistent Jan 24, 2013
@@ -15,6 +15,12 @@ class BillingAgreement implements BillingAgreementInterface
protected $partner;
protected $paymentGateway;
protected $totalCycles;
+ protected $id;
+
+ public function getId()
+ {
+ return $this->id;
+ }
public function setBillingAmount($billingAmount)
{
@@ -51,6 +51,14 @@ public function addAttribute($name, $value)
/**
* @inheritdoc
*/
+ public function setAttribute($name, $value)
+ {
+ $this->attributes[$name] = $value;
+ }
+
+ /**
+ * @inheritdoc
+ */
public function addAttributes(array $attributes)
{
$this->attributes = array_merge($this->attributes, $attributes);
@@ -19,6 +19,17 @@ class Order extends BaseOrder implements OrderInterface
protected $followUp;
protected $paymentInstruction;
+ protected $billingAgreements;
+
+ public function setBillingAgreements($billingAgreements)
+ {
+ $this->billingAgreements = $billingAgreements;
+ }
+
+ public function getBillingAgreements()
+ {
+ return $this->billingAgreements;
+ }
/**
* @inheritdoc
@@ -80,9 +80,10 @@ public function getDescription()
/**
* @inheritdoc
*/
- public function addAttribute($attribute, $value)
+ public function addAttribute(AttributeInterface $attribute)
{
- $this->attributes[$attribute] = $value;
+ $type = $attribute->getType();
+ $this->attributes[$type] = $attribute;
return $this;
}
@@ -134,6 +135,9 @@ public function getAttributes()
*/
function removeAttribute($attribute)
{
+ if ($attribute instanceof AttributeInterface) {
+ $attribute = $attribute->getType();
+ }
unset($this->attributes[$attribute]);
return $this;
@@ -144,7 +148,10 @@ function removeAttribute($attribute)
*/
public function setAttributes($attributes)
{
- $this->attributes = $attributes;
+ $this->attributes = array();
+ foreach ($attributes as $attribute) {
+ $this->addAttribute($attribute);
+ }
return $this;
}

0 comments on commit 89f5f33

Please sign in to comment.