1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2025-01-11 07:11:04 +01:00

Declare common Lisk properties

Summary:
Calling `->setPHID()` or other common Lisk setters creates an implicit public property `$phid`.
I don't like implicit properties and I see them as errors.
Its public visibility also makes me nervous and is vulnerable to bypassing any setters we may create.

Test Plan: Loaded homepage, checked log.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D3600
This commit is contained in:
vrana 2012-10-03 11:14:29 -07:00
parent 92aaffd0c5
commit 7c39c4ca7d

View file

@ -209,6 +209,12 @@ abstract class LiskDAO {
private $inSet = null; private $inSet = null;
protected $id;
protected $phid;
protected $version;
protected $dateCreated;
protected $dateModified;
/** /**
* Build an empty object. * Build an empty object.
* *
@ -920,24 +926,21 @@ abstract class LiskDAO {
} }
$id_key = $this->getIDKey(); $id_key = $this->getIDKey();
if ($id_key) { if ($id_key != 'id') {
if (!isset($properties[strtolower($id_key)])) { unset($properties['id']);
$properties[strtolower($id_key)] = $id_key;
}
} }
if ($this->getConfigOption(self::CONFIG_OPTIMISTIC_LOCKS)) { if (!$this->getConfigOption(self::CONFIG_OPTIMISTIC_LOCKS)) {
$properties['version'] = 'version'; unset($properties['version']);
} }
if ($this->getConfigOption(self::CONFIG_TIMESTAMPS)) { if (!$this->getConfigOption(self::CONFIG_TIMESTAMPS)) {
$properties['datecreated'] = 'dateCreated'; unset($properties['datecreated']);
$properties['datemodified'] = 'dateModified'; unset($properties['datemodified']);
} }
if (!$this->isPHIDPrimaryID() && if ($id_key != 'phid' && !$this->getConfigOption(self::CONFIG_AUX_PHID)) {
$this->getConfigOption(self::CONFIG_AUX_PHID)) { unset($properties['phid']);
$properties['phid'] = 'phid';
} }
} }
return $properties; return $properties;