r24778 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r24777‎ | r24778 | r24779 >
Date:08:55, 14 August 2007
Author:proes
Status:old
Tags:
Comment:
Removed strange dependence of ArrayRecord on OmegaWikiAttributes.
Modified paths:
  • /trunk/extensions/Wikidata/OmegaWiki/Record.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Wikidata/OmegaWiki/Record.php
@@ -2,7 +2,6 @@
33
44 require_once('Attribute.php');
55 require_once('RecordHelper.php');
6 -require_once('OmegaWikiAttributes.php');
76
87 interface Record {
98 public function getStructure();
@@ -14,7 +13,6 @@
1514 protected $structure;
1615 protected $values = array();
1716 protected $helper=null;
18 - #possibly associate an OmegaWikiAttributes instance (singleton?) here
1917
2018 public function __construct(Structure $structure) {
2119 $this->structure = $structure;
@@ -44,22 +42,12 @@
4543 return $this->getValueForAttributeId($attribute->id);
4644 }
4745
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);
5548 }
5649
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);
6452 }
6553 /**
6654 * Obtains a value based on the provided key.
@@ -69,7 +57,7 @@
7058 * @deprecated use __get and __set instead
7159 */
7260 public function getValue($key) {
73 - return @$this->values[$key];
 61+ return getValueForAttributeId($key);
7462 }
7563
7664 public function project(Structure $structure) {
@@ -104,8 +92,7 @@
10593 $this->setValueForAttributeId($atts[$i]->id, $values[$i]);
10694 }
10795
108 - /*
109 - *
 96+ /**
11097 * @param $record Another record object whose values get written into this one
11198 *
11299 */

Status & tagging log