29 * Concrete class for working with ItemType elements. |
29 * Concrete class for working with ItemType elements. |
30 * |
30 * |
31 * @category Zend |
31 * @category Zend |
32 * @package Zend_Gdata |
32 * @package Zend_Gdata |
33 * @subpackage Gbase |
33 * @subpackage Gbase |
34 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
34 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
35 * @license http://framework.zend.com/license/new-bsd New BSD License |
35 * @license http://framework.zend.com/license/new-bsd New BSD License |
36 */ |
36 */ |
37 class Zend_Gdata_Gbase_Extension_BaseAttribute extends Zend_Gdata_App_Extension_Element |
37 class Zend_Gdata_Gbase_Extension_BaseAttribute extends Zend_Gdata_App_Extension_Element |
38 { |
38 { |
39 |
|
40 /** |
|
41 * Namespace for Google Base elements |
|
42 * |
|
43 * var @string |
|
44 */ |
|
45 protected $_rootNamespace = 'g'; |
|
46 |
|
47 /** |
39 /** |
48 * Create a new instance. |
40 * Create a new instance. |
49 * |
41 * |
50 * @param string $name (optional) The name of the Base attribute |
42 * @param string $name (optional) The name of the Base attribute |
51 * @param string $text (optional) The text value of the Base attribute |
43 * @param string $text (optional) The text value of the Base attribute |
52 * @param string $text (optional) The type of the Base attribute |
44 * @param string $text (optional) The type of the Base attribute |
53 */ |
45 */ |
54 public function __construct($name = null, $text = null, $type = null) |
46 public function __construct($name = null, $text = null, $type = null) |
55 { |
47 { |
56 $this->registerAllNamespaces(Zend_Gdata_Gbase::$namespaces); |
48 throw new Zend_Exception( |
57 if ($type !== null) { |
49 'Google Base API has been discontinued by Google and was removed' |
58 $attr = array('name' => 'type', 'value' => $type); |
50 . ' from Zend Framework in 1.12.0. For more information see: ' |
59 $typeAttr = array('type' => $attr); |
51 . 'http://googlemerchantblog.blogspot.ca/2010/12/new-shopping-apis-and-deprecation-of.html' |
60 $this->setExtensionAttributes($typeAttr); |
52 ); |
61 } |
|
62 parent::__construct($name, |
|
63 $this->_rootNamespace, |
|
64 $this->lookupNamespace($this->_rootNamespace), |
|
65 $text); |
|
66 } |
53 } |
67 |
|
68 /** |
|
69 * Get the name of the attribute |
|
70 * |
|
71 * @return attribute name The requested object. |
|
72 */ |
|
73 public function getName() { |
|
74 return $this->_rootElement; |
|
75 } |
|
76 |
|
77 /** |
|
78 * Get the type of the attribute |
|
79 * |
|
80 * @return attribute type The requested object. |
|
81 */ |
|
82 public function getType() { |
|
83 $typeAttr = $this->getExtensionAttributes(); |
|
84 return $typeAttr['type']['value']; |
|
85 } |
|
86 |
|
87 /** |
|
88 * Set the 'name' of the Base attribute object: |
|
89 * <g:[$name] type='[$type]'>[$value]</g:[$name]> |
|
90 * |
|
91 * @param Zend_Gdata_App_Extension_Element $attribute The attribute object |
|
92 * @param string $name The name of the Base attribute |
|
93 * @return Zend_Gdata_Extension_ItemEntry Provides a fluent interface |
|
94 */ |
|
95 public function setName($name) { |
|
96 $this->_rootElement = $name; |
|
97 return $this; |
|
98 } |
|
99 |
|
100 /** |
|
101 * Set the 'type' of the Base attribute object: |
|
102 * <g:[$name] type='[$type]'>[$value]</g:[$name]> |
|
103 * |
|
104 * @param Zend_Gdata_App_Extension_Element $attribute The attribute object |
|
105 * @param string $type The type of the Base attribute |
|
106 * @return Zend_Gdata_Extension_ItemEntry Provides a fluent interface |
|
107 */ |
|
108 public function setType($type) { |
|
109 $attr = array('name' => 'type', 'value' => $type); |
|
110 $typeAttr = array('type' => $attr); |
|
111 $this->setExtensionAttributes($typeAttr); |
|
112 return $this; |
|
113 } |
|
114 |
|
115 } |
54 } |