Skip to content
Permalink
Browse files

Add stub methods for hiding/exposing properties.

  • Loading branch information...
markstory committed Nov 26, 2013
1 parent 2931b7d commit 68913a984f329959d381a28c84644439c1604ff7
Showing with 50 additions and 9 deletions.
  1. +50 −9 Cake/ORM/Entity.php
@@ -33,6 +33,23 @@ class Entity implements \ArrayAccess, \JsonSerializable {
*/
protected $_properties = [];
/**
* List of property names that should **not** be included in JSON or Array
* representations of this Entity.
*
* @var array
*/
protected $_hidden = [];
/**
* List of computed or virtual fields that **should** be included in JSON or array
* representations of this Entity. If a field is present in both _hidden and _virtual
* the field will **not** be in the array/json versions of the entity.
*
* @var array
*/
protected $_virtual = [];
/**
* Holds the name of the class for the instance object
*
@@ -277,6 +294,30 @@ public function unsetProperty($property) {
return $this;
}
/**
* Add additional properties to the hidden list.
*
* If the second argument is true, the hidden field list will be reset with
* the properties provided. The counterpart to this method is makeVisible()
*
* @param array $properties The properties to hide.
* @param boolean $reset The reset flag.
* @return void
*/
public function makeHidden($properties, $reset = false) {
}
/**
* Remove properties from the hidden list.
*
* The counterpart to this method is makeHidden().
*
* @param array $properties The properties to hide.
* @return void
*/
public function makeVisible($properties) {
}
/**
* Returns an array with all the properties that have been set
* to this entity
@@ -304,6 +345,15 @@ public function toArray() {
return $result;
}
/**
* Returns the properties that will be serialized as json
*
* @return array
*/
public function jsonSerialize() {
return $this->toArray();
}
/**
* Implements isset($entity);
*
@@ -359,15 +409,6 @@ protected function _methodExists($method) {
return isset(static::$_accessors[$this->_className][$method]);
}
/**
* Returns the properties that will be serialized as json
*
* @return array
*/
public function jsonSerialize() {
return $this->toArray();
}
/**
* Returns an array with the requested properties
* stored in this entity, indexed by property name

0 comments on commit 68913a9

Please sign in to comment.
You can’t perform that action at this time.