$this->readObjects();
}
- // get index name
- $indexName = call_user_func(array($this->className, 'getDatabaseTableIndexName'));
-
// get ids
$objectIDs = array();
foreach ($this->objects as $object) {
- $objectIDs[] = $object->__get($indexName);
+ $objectIDs[] = $object->getObjectID();
}
// execute action
}
}
+ /**
+ * Returns the id of the object.
+ *
+ * @return mixed
+ */
+ public function getObjectID() {
+ return $this->data[static::getDatabaseTableIndexName()];
+ }
+
/**
* @see wcf\data\IStorableObject::__isset()
*/
}
/**
- * @see wcf\data\DatabaseObject::__get()
+ * @see wcf\data\IStorableObject::__get()
*/
public function __get($name) {
return $this->object->__get($name);
}
/**
- * @see wcf\data\DatabaseObject::__isset()
+ * @see wcf\data\IStorableObject::__isset()
*/
public function __isset($name) {
return $this->object->__isset($name);
}
+ /**
+ * @see wcf\data\DatabaseObject::getObjectID()
+ */
+ public function getObjectID() {
+ return $this->object->getObjectID();
+ }
+
/**
* Delegates inaccessible methods calls to the decorated object.
*
$updateSQL .= $key . ' = ?';
$statementParameters[] = $value;
}
- $statementParameters[] = $this->__get(static::getDatabaseTableIndexName());
+ $statementParameters[] = $this->getObjectID();
$sql = "UPDATE ".static::getDatabaseTableName()."
SET ".$updateSQL."
$updateSQL .= $key . ' = ' . $key . ' + ?';
$statementParameters[] = $value;
}
- $statementParameters[] = $this->__get(static::getDatabaseTableIndexName());
+ $statementParameters[] = $this->getObjectID();
$sql = "UPDATE ".static::getDatabaseTableName()."
SET ".$updateSQL."
* @see wcf\data\IEditableObject::delete()
*/
public function delete() {
- static::deleteAll(array($this->__get(static::getDatabaseTableIndexName())));
+ static::deleteAll(array($this->getObjectID()));
}
/**
// use table index as array index
$objects = array();
foreach ($this->objects as $object) {
- $objectID = $object->{$this->getDatabaseTableIndexName()};
+ $objectID = $object->getObjectID();
$objects[$objectID] = $object;
$this->indexToObject[] = $objectID;