for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Doctrine\ODM\CouchDB\Functional;
class QueryTest extends \Doctrine\Tests\ODM\CouchDB\CouchDBFunctionalTestCase
{
private $dm;
public function testQuery()
$designDocPath = __DIR__ . "/../../../Models/CMS/_files";
$this->dm = $this->createDocumentManager();
$this->dm->getConfiguration()
->addDesignDocument('cms', 'Doctrine\CouchDB\View\FolderDesignDocument', $designDocPath);
$designDocPath
string
array
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example:
function acceptsInteger($int) { } $x = '123'; // string "123" // Instead of acceptsInteger($x); // we recommend to use acceptsInteger((integer) $x);
$user1 = new \Doctrine\Tests\Models\CMS\CmsUser();
$user1->username = "beberlei";
$user1->status = "active";
$user1->name = "Benjamin";
$user2 = new \Doctrine\Tests\Models\CMS\CmsUser();
$user2->username = "lsmith";
$user2->status = "active";
$user2->name = "Lukas";
$this->dm->persist($user1);
$this->dm->persist($user2);
$this->dm->flush();
$this->dm->clear();
$result = $this->dm->createQuery('cms', 'username')
->onlyDocs(true)
->setKey('lsmith')
->execute();
$this->assertCount(1, $result);
$this->assertEquals('lsmith', $result[0]->username);
->setKey('beberlei')
$this->assertEquals('beberlei', $result[0]->username);
}
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: