Skip to content

Commit

Permalink
Merge pull request UnionOfRAD#980 from jails/refactor/model-inherited…
Browse files Browse the repository at this point in the history
…-typo

Change naming for model attribute inheritance.
  • Loading branch information
gwoo committed Jun 22, 2013
2 parents 8f4ba40 + 7d5349a commit 411c69f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions data/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,10 @@ class Model extends \lithium\core\StaticObject {
/**
* Holds an array of attributes to be inherited.
*
* @see lithium\data\Model::_getInheritedAttributes()
* @see lithium\data\Model::_inherited()
* @var array
*/
protected $_inherit = array();
protected $_inherits = array();

/**
* Configures the model for use. This method will set the `Model::$_schema`, `Model::$_meta`,
Expand Down Expand Up @@ -393,7 +393,7 @@ protected static function _initialize($class) {
}
static::$_initialized[$class] = true;

$self->_applyAttrsInheritance();
$self->_inherit();

$source = array(
'classes' => array(), 'meta' => array(), 'finders' => array(), 'schema' => array()
Expand Down Expand Up @@ -444,9 +444,9 @@ protected static function _initialize($class) {
/**
* Merge parent class attributes to the current instance.
*/
protected function _applyAttrsInheritance() {
protected function _inherit() {

$inherited = array_fill_keys($this->_getInheritedAttrs(), array());
$inherited = array_fill_keys($this->_inherited(), array());

foreach (static::_parents() as $parent) {
$parentConfig = get_class_vars($parent);
Expand Down Expand Up @@ -477,8 +477,8 @@ protected function _applyAttrsInheritance() {
*
* @param array
*/
protected function _getInheritedAttrs() {
return array_merge($this->_inherit, array(
protected function _inherited() {
return array_merge($this->_inherits, array(
'validates',
'belongsTo',
'hasMany',
Expand Down
2 changes: 1 addition & 1 deletion tests/mocks/data/MockProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MockProduct extends \lithium\data\Model {

protected $_meta = array('source' => 'mock_products', 'connection' => false);

protected $_inherit = array('_custom');
protected $_inherits = array('_custom');

protected $_custom = array(
'prop1' => 'value1'
Expand Down

0 comments on commit 411c69f

Please sign in to comment.