Skip to content

Instantly share code, notes, and snippets.

@alcaeus
Last active November 8, 2016 15:00
Show Gist options
  • Save alcaeus/20e3a60507faa069521d505a49835db3 to your computer and use it in GitHub Desktop.
Save alcaeus/20e3a60507faa069521d505a49835db3 to your computer and use it in GitHub Desktop.
Builder interfaces for MongoDB query builders in a backwards compatible way
<?php
namespace Doctrine\MongoDB\Builders\Query;
class Builder implements BuilderInterface, MongoDB32BuilderInterface {
// ...
}
<?php
namespace Doctrine\MongoDB\Builders\Query;
interface BuilderInterface {
public function getQuery(): Query;
}
<?php
namespace Doctrine\ODM\MongoDB;
use Doctrine\MongoDB\Builders\Query\BuilderInterface;
class DocumentRepository
{
public function createQueryBuilder(): BuilderInterface;
}
<?php
namespace Doctrine\MongoDB\Builders\Query;
/**
* Declares query operators added in MongoDB 3.2
*/
interface MongoDB32BuilderInterface {
public function bitsAllClear($value): self;
public function bitsAllSet($value): self;
public function bitsAnyClear($value): self;
public function bitsAnySet($value): self;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment