コード例 #1
0
ファイル: Entry.php プロジェクト: robertodormepoco/zf2
 protected function takeChildFromDOM($child)
 {
     $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
     switch ($absoluteNodeName) {
         case $this->lookupNamespace('atom') . ':' . 'content':
             $content = new App\Extension\Content();
             $content->transferFromDOM($child);
             $this->_content = $content;
             break;
         case $this->lookupNamespace('atom') . ':' . 'published':
             $published = new App\Extension\Published();
             $published->transferFromDOM($child);
             $this->_published = $published;
             break;
         case $this->lookupNamespace('atom') . ':' . 'source':
             $source = new App\Extension\Source();
             $source->transferFromDOM($child);
             $this->_source = $source;
             break;
         case $this->lookupNamespace('atom') . ':' . 'summary':
             $summary = new App\Extension\Summary();
             $summary->transferFromDOM($child);
             $this->_summary = $summary;
             break;
         case $this->lookupNamespace('app') . ':' . 'control':
             $control = new App\Extension\Control();
             $control->transferFromDOM($child);
             $this->_control = $control;
             break;
         default:
             parent::takeChildFromDOM($child);
             break;
     }
 }
コード例 #2
0
ファイル: ControlTest.php プロジェクト: niallmccrudden/zf2
 public function testControlWithDraftToAndFromStringShouldMatch() {
     $draft = new Extension\Draft('yes');
     $this->control->draft = $draft;
     $controlXml = $this->control->saveXML();
     $newControl = new Extension\Control();
     $newControl->transferFromXML($controlXml);
     $newControlXml = $newControl->saveXML();
     $this->assertEquals($newControlXml, $controlXml);
     $this->assertEquals('yes', $newControl->draft->text);
 }
コード例 #3
0
ファイル: Control.php プロジェクト: niallmccrudden/zf2
 /**
  * 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('yt') . ':' . 'state':
         $state = new State();
         $state->transferFromDOM($child);
         $this->_state = $state;
         break;
     default:
         parent::takeChildFromDOM($child);
         break;
     }
 }
コード例 #4
0
ファイル: Entry.php プロジェクト: rafalwrzeszcz/zf2
 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
 {
     $element = parent::getDOM($doc, $majorVersion, $minorVersion);
     if ($this->_content != null) {
         $element->appendChild($this->_content->getDOM($element->ownerDocument));
     }
     if ($this->_published != null) {
         $element->appendChild($this->_published->getDOM($element->ownerDocument));
     }
     if ($this->_source != null) {
         $element->appendChild($this->_source->getDOM($element->ownerDocument));
     }
     if ($this->_summary != null) {
         $element->appendChild($this->_summary->getDOM($element->ownerDocument));
     }
     if ($this->_control != null) {
         $element->appendChild($this->_control->getDOM($element->ownerDocument));
     }
     if ($this->_edited != null) {
         $element->appendChild($this->_edited->getDOM($element->ownerDocument));
     }
     return $element;
 }