Skip to content

Commit

Permalink
Merge pull request #1772 from malarzm/repo-method-deprecations
Browse files Browse the repository at this point in the history
Deprecate combining repositoryMethod with skip, sort and limit
  • Loading branch information
malarzm authored Sep 5, 2018
2 parents d7fc602 + fbbccb9 commit 315deb9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,17 @@ public function mapField(array $mapping)
throw MappingException::atomicCollectionStrategyNotAllowed($mapping['strategy'], $this->name, $mapping['fieldName']);
}

if (isset($mapping['repositoryMethod']) && ! (empty($mapping['skip']) && empty($mapping['limit']) && empty($mapping['sort']))) {
@trigger_error(
sprintf(
"Combining 'repositoryMethod' with skip, limit or sort (used on '%s' in class '%s') was deprecated in 1.3 and will be removed in 2.0. Please include those in the repository method itself.",
$mapping['fieldName'],
$this->name
),
E_USER_DEPRECATED
);
}

if (isset($mapping['reference']) && $mapping['type'] === 'one') {
$mapping['association'] = self::REFERENCE_ONE;
}
Expand Down

0 comments on commit 315deb9

Please sign in to comment.