Sokil\Mongo\ExpressionTest::testWhereElemMatchWithLogicalOr PHP Method

testWhereElemMatchWithLogicalOr() public method

    public function testWhereElemMatchWithLogicalOr()
    {
        // create new document
        $document = $this->collection->createDocument(array('param' => array(array('subparam1' => 10, 'subparam2' => 20), array('subparam1' => 200, 'subparam2' => 300))));
        $document->save();
        $documentId = $document->getId();
        // find
        $q = $this->collection->find();
        $search = $q->whereOr($q->expression()->whereElemMatch('param', $q->expression()->whereGreater('subparam1', 0)->whereLess('subparam2', 30)->whereGreater('subparam2', 10)), $q->expression()->whereElemMatch('param', $q->expression()->whereGreater('subparam1', 100)->whereLess('subparam2', 400)->whereGreater('subparam2', 100)));
        $document = $search->findOne();
        $this->assertNotEmpty($document);
        $this->assertEquals($documentId, $document->getId());
    }