Skip to content

Commit

Permalink
UIV-1435 add availableFrom, availableTo, createdBy and creationDate t…
Browse files Browse the repository at this point in the history
…o Production
  • Loading branch information
lukdens committed Aug 26, 2015
1 parent 85f3f7a commit d4c736f
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions lib/CultureFeed/Cdb/Item/Production.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,58 @@
class CultureFeed_Cdb_Item_Production extends CultureFeed_Cdb_Item_Base
implements CultureFeed_Cdb_IElement {

/**
* @var string
*/
protected $availableFrom;

/**
* @var string
*/
protected $availableTo;

/**
* @var string
*/
protected $createdBy;

/**
* @var string
*/
protected $creationDate;

public function setAvailableFrom($value) {
$this->availableFrom = $value;
}

public function getAvailableFrom() {
return $this->availableFrom;
}

public function setAvailableTo($value) {
$this->availableTo = $value;
}

public function getAvailableTo() {
return $this->availableTo;
}

public function setCreatedBy($author) {
$this->createdBy = $author;
}

public function getCreatedBy() {
return $this->createdBy;
}

public function setCreationDate($value) {
$this->creationDate = $value;
}

public function getCreationDate() {
return $this->creationDate;
}

/**
* Minimum age for the production.
* @var int
Expand Down Expand Up @@ -112,6 +164,22 @@ public function appendToDOM(DOMElement $element, $cdbScheme = '3.2') {

$productionElement = $dom->createElement('production');

if ($this->availableFrom) {
$productionElement->setAttribute('availablefrom', $this->availableFrom);
}

if ($this->availableTo) {
$productionElement->setAttribute('availableto', $this->availableTo);
}

if ($this->createdBy) {
$productionElement->setAttribute('createdby', $this->createdBy);
}

if ($this->creationDate) {
$productionElement->setAttribute('creationdate', $this->creationDate);
}

if ($this->ageFrom) {
$productionElement->appendChild($dom->createElement('agefrom', $this->ageFrom));
}
Expand Down Expand Up @@ -192,6 +260,22 @@ public static function parseFromCdbXml(SimpleXMLElement $xmlElement) {
$production->setExternalId((string)$attributes['externalid']);
}

if (isset($event_attributes['availablefrom'])) {
$production->setAvailableFrom((string)$event_attributes['availablefrom']);
}

if (isset($event_attributes['availableto'])) {
$production->setAvailableTo((string)$event_attributes['availableto']);
}

if (isset($event_attributes['createdby'])) {
$production->setCreatedBy((string)$event_attributes['createdby']);
}

if (isset($event_attributes['creationdate'])) {
$production->setCreationDate((string)$event_attributes['creationdate']);
}

if (!empty($xmlElement->agefrom)) {
$production->setAgeFrom((int)$xmlElement->agefrom);
}
Expand Down

0 comments on commit d4c736f

Please sign in to comment.