Skip to content

Commit

Permalink
Rename method.
Browse files Browse the repository at this point in the history
I think extractOriginalChanged() makes more sense than OriginalDirty
did. I considered calling the method extractUntouched() at Lorenzo's
suggestion, but the method gets properties that have been touched.

Refs #6467
  • Loading branch information
markstory committed May 6, 2015
1 parent 7ad3ee6 commit 25da946
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Datasource/EntityTrait.php
Expand Up @@ -528,7 +528,7 @@ public function extract(array $properties, $onlyDirty = false)
* Returns an array with the requested original properties * Returns an array with the requested original properties
* stored in this entity, indexed by property name. * stored in this entity, indexed by property name.
* *
* Properties that have not changed will be included in the * Properties that have are unchanged changed will be included in the

This comment has been minimized.

Copy link
@antograssiot

antograssiot May 6, 2015

Contributor

something weird in this sentence...

* return of this method. * return of this method.
* *
* @param array $properties List of properties to be returned * @param array $properties List of properties to be returned
Expand All @@ -550,13 +550,13 @@ public function extractOriginal(array $properties)
* Returns an array with only the original properties * Returns an array with only the original properties
* stored in this entity, indexed by property name. * stored in this entity, indexed by property name.
* *
* This method will only return properties that have been modified. * This method will only return properties that have been modified since
* Unchanged properties will be omited. * the entity was built unchanged properties will be omitted.
* *
* @param array $properties List of properties to be returned * @param array $properties List of properties to be returned
* @return array * @return array
*/ */
public function extractOriginalDirty(array $properties) public function extractOriginalChanged(array $properties)
{ {
$result = []; $result = [];
foreach ($properties as $property) { foreach ($properties as $property) {
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Behavior/CounterCacheBehavior.php
Expand Up @@ -138,7 +138,7 @@ protected function _processAssociation(Event $event, Entity $entity, Association
$countConditions = $entity->extract($foreignKeys); $countConditions = $entity->extract($foreignKeys);
$updateConditions = array_combine($primaryKeys, $countConditions); $updateConditions = array_combine($primaryKeys, $countConditions);


$countOriginalConditions = $entity->extractOriginalDirty($foreignKeys); $countOriginalConditions = $entity->extractOriginalChanged($foreignKeys);
if ($countOriginalConditions !== []) { if ($countOriginalConditions !== []) {
$updateOriginalConditions = array_combine($primaryKeys, $countOriginalConditions); $updateOriginalConditions = array_combine($primaryKeys, $countOriginalConditions);
} }
Expand Down
2 changes: 1 addition & 1 deletion tests/TestCase/ORM/EntityTest.php
Expand Up @@ -92,7 +92,7 @@ public function testExtractOriginal()
]; ];
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);


$result = $entity->extractOriginalDirty(['id', 'title', 'body']); $result = $entity->extractOriginalChanged(['id', 'title', 'body']);
$expected = [ $expected = [
'body' => 'no', 'body' => 'no',
]; ];
Expand Down

0 comments on commit 25da946

Please sign in to comment.