Skip to content

Commit

Permalink
Changed getIdentifier() method name + visibility in NewnessChecker trait
Browse files Browse the repository at this point in the history
To ensure no collision with regular public getters from value objects
  • Loading branch information
lolautruche committed Aug 31, 2015
1 parent d1e99eb commit f3fcdce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions lib/Data/ContentTypeData.php
Expand Up @@ -35,9 +35,9 @@ class ContentTypeData extends ContentTypeUpdateStruct
*/
protected $fieldDefinitionsData = [];

public function getIdentifier()
protected function getIdentifierValue()
{
return $this->identifier;
return $this->contentTypeDraft->identifier;
}

public function addFieldDefinitionData(FieldDefinitionData $fieldDefinitionData)
Expand Down
10 changes: 7 additions & 3 deletions lib/Data/NewnessChecker.php
Expand Up @@ -18,14 +18,18 @@ trait NewnessChecker
/**
* Whether the Data object is considered new, based on the identifier
* If it isn't new, one can e.g. use the identifier from the underlying value object.
*
* @return bool
*/
public function isNew()
{
return strpos($this->getIdentifier(), '__new__') === 0;
return strpos($this->getIdentifierValue(), '__new__') === 0;
}

/**
* The value of the property which is the identifier of the value object.
* Returns the value of the property which can be considered as the value object identifier.
*
* @return string
*/
abstract public function getIdentifier();
abstract protected function getIdentifierValue();
}
4 changes: 2 additions & 2 deletions lib/Data/RoleData.php
Expand Up @@ -30,8 +30,8 @@ class RoleData extends RoleUpdateStruct
*/
protected $role;

public function getIdentifier()
protected function getIdentifierValue()
{
return $this->identifier;
return $this->role->identifier;
}
}

0 comments on commit f3fcdce

Please sign in to comment.