From 0ef975eff6b39999cc977708e7d440bb033fca17 Mon Sep 17 00:00:00 2001 From: Artur Dzida Date: Wed, 14 Jun 2017 14:39:28 +0200 Subject: [PATCH] bug/CollectionValidator fixed bug, so you can pass validator while creating the collection --- src/Collection/Definition.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Collection/Definition.php b/src/Collection/Definition.php index 1a5bdd4..0e20de4 100644 --- a/src/Collection/Definition.php +++ b/src/Collection/Definition.php @@ -172,11 +172,15 @@ public function getExpressionClass() public function getMongoCollectionOptions() { - return array( + $result = array( 'capped' => $this->capped, 'size' => $this->size, - 'max' => $this->max, + 'max' => $this->max, ); + if (isset($this->options['validator'])) { + $result['validator'] = $this->options['validator']; + } + return $result; } public function getOptions()