@@ -19,6 +19,9 @@ |
||
| 19 | 19 | |
| 20 | 20 | private $collection; |
| 21 | 21 | |
| 22 | + /** |
|
| 23 | + * @param string $collectionName |
|
| 24 | + */ |
|
| 22 | 25 | public function __construct(Database $database, $collectionName) |
| 23 | 26 | { |
| 24 | 27 | $this->collection = $database |
@@ -114,6 +114,9 @@ |
||
| 114 | 114 | return $this->dbVersion; |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | + /** |
|
| 118 | + * @param string $dsn |
|
| 119 | + */ |
|
| 117 | 120 | public function setDsn($dsn) |
| 118 | 121 | { |
| 119 | 122 | $this->dsn = $dsn; |
@@ -32,6 +32,9 @@ discard block |
||
| 32 | 32 | return $this; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | + /** |
|
| 36 | + * @param string $fieldName |
|
| 37 | + */ |
|
| 35 | 38 | public function push($fieldName, $value) |
| 36 | 39 | { |
| 37 | 40 | // value must be list, not dictionary |
@@ -68,6 +71,9 @@ discard block |
||
| 68 | 71 | return $this; |
| 69 | 72 | } |
| 70 | 73 | |
| 74 | + /** |
|
| 75 | + * @param string $fieldName |
|
| 76 | + */ |
|
| 71 | 77 | public function pushEach($fieldName, array $values) |
| 72 | 78 | { |
| 73 | 79 | // value must be list, not dictionary |
@@ -296,6 +302,9 @@ discard block |
||
| 296 | 302 | return $this; |
| 297 | 303 | } |
| 298 | 304 | |
| 305 | + /** |
|
| 306 | + * @param string $operation |
|
| 307 | + */ |
|
| 299 | 308 | public function get($operation, $fieldName = null) |
| 300 | 309 | { |
| 301 | 310 | if($fieldName) { |
@@ -331,7 +340,7 @@ discard block |
||
| 331 | 340 | /** |
| 332 | 341 | * Transform operator in different formats to canonical array form |
| 333 | 342 | * |
| 334 | - * @param mixed $mixed |
|
| 343 | + * @param callable $mixed |
|
| 335 | 344 | * @return array |
| 336 | 345 | * @throws \Sokil\Mongo\Exception |
| 337 | 346 | */ |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | * |
| 61 | 61 | * @param string $selector |
| 62 | 62 | * @param string|callable $className string class name or closure, which accept data and return string class name |
| 63 | - * @return object representation of document with class, passed as argument |
|
| 63 | + * @return null|Structure representation of document with class, passed as argument |
|
| 64 | 64 | * @throws \Sokil\Mongo\Exception |
| 65 | 65 | */ |
| 66 | 66 | public function getObject($selector, $className) |
@@ -208,6 +208,9 @@ discard block |
||
| 208 | 208 | return $this; |
| 209 | 209 | } |
| 210 | 210 | |
| 211 | + /** |
|
| 212 | + * @param string $selector |
|
| 213 | + */ |
|
| 211 | 214 | public function has($selector) |
| 212 | 215 | { |
| 213 | 216 | $pointer = &$this->_data; |
@@ -263,6 +266,9 @@ discard block |
||
| 263 | 266 | return (array) $value; |
| 264 | 267 | } |
| 265 | 268 | |
| 269 | + /** |
|
| 270 | + * @param string $selector |
|
| 271 | + */ |
|
| 266 | 272 | public function unsetField($selector) |
| 267 | 273 | { |
| 268 | 274 | // modify |
@@ -331,6 +337,9 @@ discard block |
||
| 331 | 337 | return $this; |
| 332 | 338 | } |
| 333 | 339 | |
| 340 | + /** |
|
| 341 | + * @param string $selector |
|
| 342 | + */ |
|
| 334 | 343 | public function isModified($selector = null) |
| 335 | 344 | { |
| 336 | 345 | if(!$this->_modifiedFields) { |
@@ -12,7 +12,6 @@ |
||
| 12 | 12 | namespace Sokil\Mongo; |
| 13 | 13 | |
| 14 | 14 | use Sokil\Mongo\Pipeline\GroupStage; |
| 15 | - |
|
| 16 | 15 | use Sokil\Mongo\ArrayableInterface; |
| 17 | 16 | |
| 18 | 17 | class Pipeline implements |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | /** |
| 442 | 442 | * Store document to pool |
| 443 | 443 | * |
| 444 | - * @param array $document |
|
| 444 | + * @param Document $document |
|
| 445 | 445 | * @return \Sokil\Mongo\Collection |
| 446 | 446 | */ |
| 447 | 447 | public function addDocumentToDocumentPool(Document $document) |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | * |
| 583 | 583 | * @param string|\MongoId $id |
| 584 | 584 | * @param callable $callable cursor callable used to configure cursor |
| 585 | - * @return \Sokil\Mongo\Document|array|null |
|
| 585 | + * @return Document |
|
| 586 | 586 | */ |
| 587 | 587 | public function getDocumentDirectly($id, $callable = null) |
| 588 | 588 | { |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | * Check if document belongs to collection |
| 603 | 603 | * |
| 604 | 604 | * @param \Sokil\Mongo\Document $document |
| 605 | - * @return type |
|
| 605 | + * @return boolean |
|
| 606 | 606 | */ |
| 607 | 607 | public function hasDocument(Document $document) |
| 608 | 608 | { |
@@ -172,6 +172,9 @@ |
||
| 172 | 172 | return $this->whereHasType($field, FieldType::NULL); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | + /** |
|
| 176 | + * @param string $condition |
|
| 177 | + */ |
|
| 175 | 178 | public function whereJsCondition($condition) |
| 176 | 179 | { |
| 177 | 180 | return $this->where('$where', $condition); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | 56 | * @param Client $client |
| 57 | - * @param \MongoDB|string $database |
|
| 57 | + * @param string $database |
|
| 58 | 58 | */ |
| 59 | 59 | public function __construct(Client $client, $database) { |
| 60 | 60 | $this->client = $client; |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | /** |
| 154 | 154 | * Reset specified mapping |
| 155 | 155 | * |
| 156 | - * @return \Sokil\Mongo\Client |
|
| 156 | + * @return Database |
|
| 157 | 157 | */ |
| 158 | 158 | public function resetMapping() |
| 159 | 159 | { |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * |
| 168 | 168 | * @param string|array $name collection name or array like [collectionName => collectionClass, ...] |
| 169 | 169 | * @param string|array|Definition|null $classDefinition if $name is string, then full class name or array with parameters, else omitted |
| 170 | - * @return \Sokil\Mongo\Client |
|
| 170 | + * @return Database |
|
| 171 | 171 | */ |
| 172 | 172 | public function map($name, $classDefinition = null) |
| 173 | 173 | { |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @param string $name name of collection |
| 230 | 230 | * @param array $defaultDefinition definition used when no definition found for defined class |
| 231 | 231 | * @throws Exception |
| 232 | - * @return string|array name of class or array of class definition |
|
| 232 | + * @return string name of class or array of class definition |
|
| 233 | 233 | */ |
| 234 | 234 | private function getCollectionDefinition($name, array $defaultDefinition = null) |
| 235 | 235 | { |
@@ -132,11 +132,17 @@ |
||
| 132 | 132 | return $this->options; |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | + /** |
|
| 136 | + * @param string $name |
|
| 137 | + */ |
|
| 135 | 138 | public function getOption($name, $default = null) |
| 136 | 139 | { |
| 137 | 140 | return isset($this->options[$name]) ? $this->options[$name] : $default; |
| 138 | 141 | } |
| 139 | 142 | |
| 143 | + /** |
|
| 144 | + * @param string $name |
|
| 145 | + */ |
|
| 140 | 146 | public function hasOption($name) |
| 141 | 147 | { |
| 142 | 148 | return isset($this->options[$name]); |