Пример #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->_login !== null) {
         $element->appendChild($this->_login->getDOM($element->ownerDocument));
     }
     if ($this->_nickname !== null) {
         $element->appendChild($this->_nickname->getDOM($element->ownerDocument));
     }
     return $element;
 }
Пример #2
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->_login !== null) {
         $element->appendChild($this->_login->getDOM($element->ownerDocument));
     }
     if ($this->_name !== null) {
         $element->appendChild($this->_name->getDOM($element->ownerDocument));
     }
     if ($this->_quota !== null) {
         $element->appendChild($this->_quota->getDOM($element->ownerDocument));
     }
     foreach ($this->_feedLink as $feedLink) {
         $element->appendChild($feedLink->getDOM($element->ownerDocument));
     }
     return $element;
 }
Пример #3
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') . ':' . 'login':
             $login = new Extension\Login();
             $login->transferFromDOM($child);
             $this->_login = $login;
             break;
         case $this->lookupNamespace('apps') . ':' . 'nickname':
             $nickname = new Extension\Nickname();
             $nickname->transferFromDOM($child);
             $this->_nickname = $nickname;
             break;
         default:
             parent::takeChildFromDOM($child);
             break;
     }
 }
Пример #4
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') . ':' . 'login':
             $login = new Extension\Login();
             $login->transferFromDOM($child);
             $this->_login = $login;
             break;
         case $this->lookupNamespace('apps') . ':' . 'name':
             $name = new Extension\Name();
             $name->transferFromDOM($child);
             $this->_name = $name;
             break;
         case $this->lookupNamespace('apps') . ':' . 'quota':
             $quota = new Extension\Quota();
             $quota->transferFromDOM($child);
             $this->_quota = $quota;
             break;
         case $this->lookupNamespace('gd') . ':' . 'feedLink':
             $feedLink = new \ZendGData\Extension\FeedLink();
             $feedLink->transferFromDOM($child);
             $this->_feedLink[] = $feedLink;
             break;
         default:
             parent::takeChildFromDOM($child);
             break;
     }
 }
Пример #5
0
 public function testExtensionAttributes()
 {
     $extensionAttributes = $this->login->extensionAttributes;
     $extensionAttributes['foo1'] = array('name' => 'foo1', 'value' => 'bar');
     $extensionAttributes['foo2'] = array('name' => 'foo2', 'value' => 'rab');
     $this->login->extensionAttributes = $extensionAttributes;
     $this->assertEquals('bar', $this->login->extensionAttributes['foo1']['value']);
     $this->assertEquals('rab', $this->login->extensionAttributes['foo2']['value']);
     $loginXml = $this->login->saveXML();
     $newLogin = new Extension\Login();
     $newLogin->transferFromXML($loginXml);
     $this->assertEquals('bar', $newLogin->extensionAttributes['foo1']['value']);
     $this->assertEquals('rab', $newLogin->extensionAttributes['foo2']['value']);
 }