Skip to content

Commit

Permalink
Merge pull request #2399 from cakephp/3.0-propertyName
Browse files Browse the repository at this point in the history
Rename property -> propertyName
  • Loading branch information
lorenzo committed Nov 28, 2013
2 parents dd95ba9 + 29f27bb commit f669d8c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions Cake/ORM/Association.php
Expand Up @@ -129,7 +129,7 @@ abstract class Association {
*
* @var string
*/
protected $_property;
protected $_propertyName;

/**
* The strategy name to be used to fetch associated records. Some association
Expand Down Expand Up @@ -157,7 +157,7 @@ public function __construct($name, array $options = []) {
'sourceTable',
'targetTable',
'joinType',
'property'
'propertyName'
];
foreach ($defaults as $property) {
if (isset($options[$property])) {
Expand Down Expand Up @@ -306,12 +306,12 @@ public function joinType($type = null) {
*/
public function property($name = null) {
if ($name !== null) {
$this->_property = $name;
$this->_propertyName = $name;
}
if ($name === null && !$this->_property) {
$this->_property = Inflector::underscore($this->_name);
if ($name === null && !$this->_propertyName) {
$this->_propertyName = Inflector::underscore($this->_name);
}
return $this->_property;
return $this->_propertyName;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions Cake/ORM/Association/BelongsTo.php
Expand Up @@ -80,10 +80,10 @@ public function property($name = null) {
if ($name !== null) {
return parent::property($name);
}
if ($name === null && !$this->_property) {
$this->_property = Inflector::underscore(Inflector::singularize($this->_name));
if ($name === null && !$this->_propertyName) {
$this->_propertyName = Inflector::underscore(Inflector::singularize($this->_name));
}
return $this->_property;
return $this->_propertyName;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions Cake/ORM/Association/HasOne.php
Expand Up @@ -76,10 +76,10 @@ public function property($name = null) {
if ($name !== null) {
return parent::property($name);
}
if ($name === null && !$this->_property) {
$this->_property = Inflector::underscore(Inflector::singularize($this->_name));
if ($name === null && !$this->_propertyName) {
$this->_propertyName = Inflector::underscore(Inflector::singularize($this->_name));
}
return $this->_property;
return $this->_propertyName;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Cake/Test/TestApp/Model/Repository/TagsTable.php
Expand Up @@ -22,7 +22,7 @@ class TagsTable extends Table {
public function initialize(array $config) {
$this->belongsTo('authors');
$this->belongsToMany('tags');
$this->hasMany('articlesTags', ['property' => 'extraInfo']);
$this->hasMany('articlesTags', ['propertyName' => 'extraInfo']);
}

}

0 comments on commit f669d8c

Please sign in to comment.