8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
25 * @see Zend_Gdata_Entry
27 require_once 'Zend/Gdata/Entry.php';
30 * @see Zend_Gdata_Photos_Extension_Id
32 require_once 'Zend/Gdata/Photos/Extension/Id.php';
35 * @see Zend_Gdata_Photos_Extension_PhotoId
37 require_once 'Zend/Gdata/Photos/Extension/PhotoId.php';
40 * @see Zend_Gdata_Photos_Extension_Weight
42 require_once 'Zend/Gdata/Photos/Extension/Weight.php';
45 * @see Zend_Gdata_App_Extension_Category
47 require_once 'Zend/Gdata/App/Extension/Category.php';
50 * Data model class for a Comment Entry.
52 * To transfer user entries to and from the servers, including
53 * creating new entries, refer to the service class,
56 * This class represents <atom:entry> in the Google Data protocol.
61 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
62 * @license http://framework.zend.com/license/new-bsd New BSD License
64 class Zend_Gdata_Photos_CommentEntry extends Zend_Gdata_Entry
67 protected $_entryClassName = 'Zend_Gdata_Photos_CommentEntry';
72 * @var Zend_Gdata_Photos_Extension_Id
74 protected $_gphotoId = null;
77 * gphoto:photoid element, differs from gphoto:id as this is an
78 * actual identification number unique exclusively to photo entries,
79 * whereas gphoto:id can refer to all gphoto objects
81 * @var Zend_Gdata_Photos_Extension_PhotoId
83 protected $_gphotoPhotoId = null;
86 * Create a new instance.
88 * @param DOMElement $element (optional) DOMElement from which this
89 * object should be constructed.
91 public function __construct($element = null)
93 $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
94 parent::__construct($element);
96 $category = new Zend_Gdata_App_Extension_Category(
97 'http://schemas.google.com/photos/2007#comment',
98 'http://schemas.google.com/g/2005#kind');
99 $this->setCategory(array($category));
103 * Retrieves a DOMElement which corresponds to this element and all
104 * child properties. This is used to build an entry back into a DOM
105 * and eventually XML text for application storage/persistence.
107 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
108 * @return DOMElement The DOMElement representing this element and all
111 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
113 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
114 if ($this->_gphotoId !== null) {
115 $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument));
117 if ($this->_gphotoPhotoId !== null) {
118 $element->appendChild($this->_gphotoPhotoId->getDOM($element->ownerDocument));
124 * Creates individual Entry objects of the appropriate type and
125 * stores them as members of this entry based upon DOM data.
127 * @param DOMNode $child The DOMNode to process
129 protected function takeChildFromDOM($child)
131 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
133 switch ($absoluteNodeName) {
134 case $this->lookupNamespace('gphoto') . ':' . 'id';
135 $id = new Zend_Gdata_Photos_Extension_Id();
136 $id->transferFromDOM($child);
137 $this->_gphotoId = $id;
139 case $this->lookupNamespace('gphoto') . ':' . 'photoid';
140 $photoid = new Zend_Gdata_Photos_Extension_PhotoId();
141 $photoid->transferFromDOM($child);
142 $this->_gphotoPhotoId = $photoid;
145 parent::takeChildFromDOM($child);
151 * Get the value for this element's gphoto:photoid attribute.
153 * @see setGphotoPhotoId
154 * @return string The requested attribute.
156 public function getGphotoPhotoId()
158 return $this->_gphotoPhotoId;
162 * Set the value for this element's gphoto:photoid attribute.
164 * @param string $value The desired value for this attribute.
165 * @return Zend_Gdata_Photos_Extension_PhotoId The element being modified.
167 public function setGphotoPhotoId($value)
169 $this->_gphotoPhotoId = $value;
174 * Get the value for this element's gphoto:id attribute.
177 * @return string The requested attribute.
179 public function getGphotoId()
181 return $this->_gphotoId;
185 * Set the value for this element's gphoto:id attribute.
187 * @param string $value The desired value for this attribute.
188 * @return Zend_Gdata_Photos_Extension_Id The element being modified.
190 public function setGphotoId($value)
192 $this->_gphotoId = $value;