Module provides Codeception integration with Doctrine MongoDB ODM
Allows integration and testing for projects with Doctrine MongoDB ODM. DoctrineMongoOdm uses DocumentManager to perform all database operations., (*1)
You should specify a callback function to receive entity manager:, (*2)
modules: enabled: - DoctrineMongoOdm: connection_callback: ['MyDb', 'createDocumentManager']
This will use static method of MyDb::createDocumentManager()
to establish DocumentManager., (*3)
connection_callback: - callable that will return an instance of DocumentManager. This is a must., (*4)
functional.suite.yml
)modules: enabled: [DoctrineMongoOdm] config: DoctrineMongoOdm: cleanup: false, (*5)
dm
- Document ManagerFlushes changes to database and performs ->findOneBy() call for current repository., (*6)
param
$entityparam array
$paramsPerforms $dm->flush();, (*7)
Selects field value from repository. It builds query based on array of parameters. You can use entity associations to build complex queries., (*8)
Example:, (*9)
``` php grabFromRepository('User', 'email', array('name' => 'davert')); ?>, (*10)
* `param` $entity * `param` $field * `param array` $params * `return` array ### haveInRepository Persists record into repository. This method crates an entity, and sets its properties directly (via reflection). Setters of entity won't be executed, but you can create almost any entity and save it to database. Returns id using `getId` of newly created entity. ```php $I->haveInRepository('Entity\User', array('name' => 'davert'));
Adds entity to repository and flushes. You can redefine it's properties with the second parameter., (*11)
Example:, (*12)
``` php <?php $I->persistEntity(new \Entity\User, array('name' => 'Miles')); $I->persistEntity($user, array('name' => 'Miles'));, (*13)
* `param` $obj * `param array` $values ### seeInRepository Flushes changes to database executes a query defined by array. It builds query based on array of parameters. You can use entity associations to build complex queries. Example: ``` php <?php $I->seeInRepository('User', array('name' => 'davert')); $I->seeInRepository('User', array('name' => 'davert', 'Company' => array('name' => 'Codegyre'))); $I->seeInRepository('Client', array('User' => array('Company' => array('name' => 'Codegyre'))); ?>
Fails if record for given criteria can\'t be found,, (*14)
param
$entityparam array
$params