Page MenuHomePhabricator

D9895.id23755.diff
No OneTemporary

D9895.id23755.diff

diff --git a/src/applications/people/storage/PhabricatorUser.php b/src/applications/people/storage/PhabricatorUser.php
--- a/src/applications/people/storage/PhabricatorUser.php
+++ b/src/applications/people/storage/PhabricatorUser.php
@@ -113,7 +113,6 @@
public function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
- self::CONFIG_PARTIAL_OBJECTS => true,
) + parent::getConfiguration();
}
diff --git a/src/infrastructure/storage/lisk/LiskDAO.php b/src/infrastructure/storage/lisk/LiskDAO.php
--- a/src/infrastructure/storage/lisk/LiskDAO.php
+++ b/src/infrastructure/storage/lisk/LiskDAO.php
@@ -168,7 +168,6 @@
const CONFIG_TIMESTAMPS = 'timestamps';
const CONFIG_AUX_PHID = 'auxiliary-phid';
const CONFIG_SERIALIZATION = 'col-serialization';
- const CONFIG_PARTIAL_OBJECTS = 'partial-objects';
const CONFIG_BINARY = 'binary';
const SERIALIZATION_NONE = 'id';
@@ -181,8 +180,6 @@
const COUNTER_TABLE_NAME = 'lisk_counter';
- private $dirtyFields = array();
- private $missingFields = array();
private static $processIsolationLevel = 0;
private static $transactionIsolationLevel = 0;
@@ -207,10 +204,6 @@
if ($id_key) {
$this->$id_key = null;
}
-
- if ($this->getConfigOption(self::CONFIG_PARTIAL_OBJECTS)) {
- $this->resetDirtyFields();
- }
}
@@ -345,16 +338,6 @@
* This will cause Lisk to JSON-serialize the 'complex' field before it is
* written, and unserialize it when it is read.
*
- * CONFIG_PARTIAL_OBJECTS
- * Sometimes, it is useful to load only some fields of an object (such as
- * when you are loading all objects of a class, but only care about a few
- * fields). Turning on this option (by setting it to a truthy value) allows
- * users of the class to create/use partial objects, but it comes with some
- * side effects: your class cannot override the setters and getters provided
- * by Lisk (use readField and writeField instead), and you should not
- * directly access or assign protected members of your class (use the getters
- * and setters).
- *
* CONFIG_BINARY
* You can optionally provide a map of columns to a flag indicating that
* they store binary data. These columns will not raise an error when
@@ -368,7 +351,6 @@
return array(
self::CONFIG_IDS => self::IDS_AUTOINCREMENT,
self::CONFIG_TIMESTAMPS => true,
- self::CONFIG_PARTIAL_OBJECTS => false,
);
}
@@ -435,18 +417,6 @@
return $this->loadAllWhere('1 = 1');
}
- /**
- * Loads all objects, but only fetches the specified columns.
- *
- * @param array Array of canonical column names as strings
- * @return dict Dictionary of all objects, keyed by ID.
- *
- * @task load
- */
- public function loadColumns(array $columns) {
- return $this->loadColumnsWhere($columns, '1 = 1');
- }
-
/**
* Load all objects which match a WHERE clause. You provide everything after
@@ -464,30 +434,6 @@
*/
public function loadAllWhere($pattern /* , $arg, $arg, $arg ... */) {
$args = func_get_args();
- array_unshift($args, null);
- $data = call_user_func_array(
- array($this, 'loadRawDataWhere'),
- $args);
- return $this->loadAllFromArray($data);
- }
-
- /**
- * Loads selected columns from objects that match a WHERE clause. You must
- * provide everything after the WHERE. See loadAllWhere().
- *
- * @param array List of column names.
- * @param string queryfx()-style SQL WHERE clause.
- * @param ... Zero or more conversions.
- * @return dict Dictionary of matching objecks, keyed by ID.
- *
- * @task load
- */
- public function loadColumnsWhere(array $columns, $pattern /* , $args... */) {
- if (!$this->getConfigOption(self::CONFIG_PARTIAL_OBJECTS)) {
- throw new BadMethodCallException(
- 'This class does not support partial objects.');
- }
- $args = func_get_args();
$data = call_user_func_array(
array($this, 'loadRawDataWhere'),
$args);
@@ -509,7 +455,6 @@
*/
public function loadOneWhere($pattern /* , $arg, $arg, $arg ... */) {
$args = func_get_args();
- array_unshift($args, null);
$data = call_user_func_array(
array($this, 'loadRawDataWhere'),
$args);
@@ -528,7 +473,7 @@
}
- protected function loadRawDataWhere($columns, $pattern /* , $args... */) {
+ protected function loadRawDataWhere($pattern /* , $args... */) {
$connection = $this->establishConnection('r');
$lock_clause = '';
@@ -539,25 +484,10 @@
}
$args = func_get_args();
- $args = array_slice($args, 2);
-
- if (!$columns) {
- $column = '*';
- } else {
- $column = '%LC';
- $columns[] = $this->getIDKey();
-
- $properties = $this->getProperties();
- $this->missingFields = array_diff_key(
- array_flip($properties),
- array_flip($columns));
- }
+ $args = array_slice($args, 1);
- $pattern = 'SELECT '.$column.' FROM %T WHERE '.$pattern.' %Q';
+ $pattern = 'SELECT * FROM %T WHERE '.$pattern.' %Q';
array_unshift($args, $this->getTableName());
- if ($columns) {
- array_unshift($args, $columns);
- }
array_push($args, $lock_clause);
array_unshift($args, $pattern);
@@ -1141,9 +1071,6 @@
$this->willSaveObject();
$data = $this->getPropertyValues();
- if ($this->getConfigOption(self::CONFIG_PARTIAL_OBJECTS)) {
- $data = array_intersect_key($data, $this->dirtyFields);
- }
$this->willWriteData($data);
$map = array();
@@ -1176,10 +1103,6 @@
$this->didWriteData();
- if ($this->getConfigOption(self::CONFIG_PARTIAL_OBJECTS)) {
- $this->resetDirtyFields();
- }
-
return $this;
}
@@ -1286,10 +1209,6 @@
$this->didWriteData();
- if ($this->getConfigOption(self::CONFIG_PARTIAL_OBJECTS)) {
- $this->resetDirtyFields();
- }
-
return $this;
}
@@ -1681,20 +1600,6 @@
}
/**
- * Resets the dirty fields (fields which need to be written on next save/
- * update/insert/replace). If this DAO has timestamps, the modified time
- * is always a dirty field.
- *
- * @task util
- */
- private function resetDirtyFields() {
- $this->dirtyFields = array();
- if ($this->getConfigOption(self::CONFIG_TIMESTAMPS)) {
- $this->dirtyFields['dateModified'] = true;
- }
- }
-
- /**
* Black magic. Builds implied get*() and set*() for all properties.
*
* @param string Method name.
@@ -1719,10 +1624,6 @@
// optimizations.
static $dispatch_map = array();
- static $partial = null;
- if ($partial === null) {
- $partial = $this->getConfigOption(self::CONFIG_PARTIAL_OBJECTS);
- }
if ($method[0] === 'g') {
if (isset($dispatch_map[$method])) {
@@ -1738,10 +1639,6 @@
$dispatch_map[$method] = $property;
}
- if ($partial && isset($this->missingFields[$property])) {
- throw new Exception("Cannot get field that wasn't loaded: {$property}");
- }
-
return $this->readField($property);
}
@@ -1759,11 +1656,6 @@
}
$dispatch_map[$method] = $property;
}
- if ($partial) {
- // Accept writes to fields that weren't initially loaded
- unset($this->missingFields[$property]);
- $this->dirtyFields[$property] = true;
- }
$this->writeField($property, $args[0]);

File Metadata

Mime Type
text/plain
Expires
Sat, May 11, 12:42 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6285036
Default Alt Text
D9895.id23755.diff (7 KB)

Event Timeline