/** * @param Collection $collection * @param bool|false $prefix * * @return array */ protected function getConditionArray(Collection $collection, $prefix = false) { $condition = $collection->getCondition(); if (!is_array($condition)) { $condition = ['_id' => $this->createObjectId($condition)]; } if ($prefix) { $condition = static::prefixArrayKeys($condition, $collection->getName() . '.'); } return $condition; }
function test_magic_getter_should_bypass_to_collection() { $collection = $this->mapper->foo->bar->baz; $expected = Collection::foo(); $expected->setMapper($this->mapper); $this->assertEquals($expected->bar->baz, $collection); }
public function filterable(Collection $collection) { return $collection->have('filters'); }
function test_getChildren_use_collection_next() { $coll = Collection::foo()->bar; $iterator = new CollectionIterator($coll); $this->assertTrue($iterator->hasChildren()); }
public function setNext(Collection $collection) { $collection->setParent($this); $collection->setMapper($this->mapper); $this->next = $collection; }
public function registerCollection($alias, Collection $collection) { $collection->setMapper($this); $this->collections[$alias] = $collection; }
/** * @param Collection $collection * * @return array */ protected function getConditionArray(Collection $collection) { $condition = $collection->getCondition(); if (!is_array($condition)) { $condition = ['_id' => $condition]; } $conditions = []; foreach ($condition as $key => $value) { $conditions = [$key => ['AttributeValueList' => [$this->marshaler->marshalValue($value)], 'ComparisonOperator' => 'EQ']]; } return $conditions; }
public function provideGenerateQueryShouldUsePartialResultSets() { return ['simple' => [Collection::article()->author[42], ['_id' => ['AttributeValueList' => [['N' => 42]], 'ComparisonOperator' => 'EQ']]]]; }
public function testGenerateQueryShouldReturnSimpleFind() { $result = $this->driver->generateQuery(Collection::my_coll()); $this->assertEquals([], $result); }
public function provideActionMethodsAndRespectiveArguments() { return ['insert' => ['insert', ['collection', []]], 'update' => ['update', ['collection', [], []]], 'remove' => ['remove', ['collection', []]], 'fetch' => ['fetch', [new \IteratorIterator(new \ArrayObject())]], 'find' => ['find', ['collection', []]], 'generateQuery' => ['generateQuery', [Collection::coll()]]]; }
public function provideGenerateQueryShouldUsePartialResultSets() { return ['simple' => [Collection::article()->author['56d6fb233f90a8231f0041a9'], ['author._id' => new ObjectID('56d6fb233f90a8231f0041a9')]]]; }