Index: trunk/extensions/Wikidata/OmegaWiki/Record.php |
— | — | @@ -2,7 +2,6 @@ |
3 | 3 | |
4 | 4 | require_once('Attribute.php'); |
5 | 5 | require_once('RecordHelper.php'); |
6 | | -require_once('OmegaWikiAttributes.php'); |
7 | 6 | |
8 | 7 | interface Record { |
9 | 8 | public function getStructure(); |
— | — | @@ -14,7 +13,6 @@ |
15 | 14 | protected $structure; |
16 | 15 | protected $values = array(); |
17 | 16 | protected $helper=null; |
18 | | - #possibly associate an OmegaWikiAttributes instance (singleton?) here |
19 | 17 | |
20 | 18 | public function __construct(Structure $structure) { |
21 | 19 | $this->structure = $structure; |
— | — | @@ -44,22 +42,12 @@ |
45 | 43 | return $this->getValueForAttributeId($attribute->id); |
46 | 44 | } |
47 | 45 | |
48 | | - /** |
49 | | - * Look up the correct attribute using omegaWikiAttributes |
50 | | - * and return its value |
51 | | - */ |
52 | | - public function __get($attributeName) { |
53 | | - $o = OmegaWikiAttributes::getInstance(); |
54 | | - return $this->getAttributeValue($o->$attributeName); |
| 46 | + public function __get($attributeId) { |
| 47 | + return $this->getValueForAttributeId($attributeId); |
55 | 48 | } |
56 | 49 | |
57 | | - /** |
58 | | - * Look up the correct attribute using omegaWikiAttributes |
59 | | - * and set its value |
60 | | - */ |
61 | | - public function __set($attributeName, $value) { |
62 | | - $o = OmegaWikiAttributes::getInstance(); |
63 | | - return $this->setAttributeValue($o->$attributeName, $value); |
| 50 | + public function __set($attributeId, $value) { |
| 51 | + return $this->setValueForAttributeId($attributeId, $value); |
64 | 52 | } |
65 | 53 | /** |
66 | 54 | * Obtains a value based on the provided key. |
— | — | @@ -69,7 +57,7 @@ |
70 | 58 | * @deprecated use __get and __set instead |
71 | 59 | */ |
72 | 60 | public function getValue($key) { |
73 | | - return @$this->values[$key]; |
| 61 | + return getValueForAttributeId($key); |
74 | 62 | } |
75 | 63 | |
76 | 64 | public function project(Structure $structure) { |
— | — | @@ -104,8 +92,7 @@ |
105 | 93 | $this->setValueForAttributeId($atts[$i]->id, $values[$i]); |
106 | 94 | } |
107 | 95 | |
108 | | - /* |
109 | | - * |
| 96 | + /** |
110 | 97 | * @param $record Another record object whose values get written into this one |
111 | 98 | * |
112 | 99 | */ |