Exemplo n.º 1
0
 /**
  * Retrieves a DOMElement which corresponds to this element and all
  * child properties.  This is used to build an entry back into a DOM
  * and eventually XML text for application storage/persistence.
  *
  * @param DOMDocument $doc The DOMDocument used to construct DOMElements
  * @return DOMElement The DOMElement representing this element and all
  *          child properties.
  */
 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
 {
     $element = parent::getDOM($doc, $majorVersion, $minorVersion);
     if ($this->_emailList !== null) {
         $element->appendChild($this->_emailList->getDOM($element->ownerDocument));
     }
     foreach ($this->_feedLink as $feedLink) {
         $element->appendChild($feedLink->getDOM($element->ownerDocument));
     }
     return $element;
 }
Exemplo n.º 2
0
 /**
  * Creates individual Entry objects of the appropriate type and
  * stores them as members of this entry based upon DOM data.
  *
  * @param DOMNode $child The DOMNode to process
  */
 protected function takeChildFromDOM($child)
 {
     $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
     switch ($absoluteNodeName) {
         case $this->lookupNamespace('apps') . ':' . 'emailList':
             $emailList = new Extension\EmailList();
             $emailList->transferFromDOM($child);
             $this->_emailList = $emailList;
             break;
         case $this->lookupNamespace('gd') . ':' . 'feedLink':
             $feedLink = new \ZendGData\Extension\FeedLink();
             $feedLink->transferFromDOM($child);
             $this->_feedLink[] = $feedLink;
             break;
         default:
             parent::takeChildFromDOM($child);
             break;
     }
 }
Exemplo n.º 3
0
 public function testExtensionAttributes()
 {
     $extensionAttributes = $this->emailList->extensionAttributes;
     $extensionAttributes['foo1'] = array('name' => 'foo1', 'value' => 'bar');
     $extensionAttributes['foo2'] = array('name' => 'foo2', 'value' => 'rab');
     $this->emailList->extensionAttributes = $extensionAttributes;
     $this->assertEquals('bar', $this->emailList->extensionAttributes['foo1']['value']);
     $this->assertEquals('rab', $this->emailList->extensionAttributes['foo2']['value']);
     $emailListXml = $this->emailList->saveXML();
     $newEmailList = new Extension\EmailList();
     $newEmailList->transferFromXML($emailListXml);
     $this->assertEquals('bar', $newEmailList->extensionAttributes['foo1']['value']);
     $this->assertEquals('rab', $newEmailList->extensionAttributes['foo2']['value']);
 }