Bolt\Storage\Query\SelectQuery::setContentType PHP Method

setContentType() public method

Sets the ContentType that this query will run against.
public setContentType ( string $contentType )
$contentType string
    public function setContentType($contentType)
    {
        $this->contentType = $contentType;
    }

Usage Example

Example #1
0
 public function testQuery()
 {
     $app = $this->getApp();
     $filters = ['username' => '%fred%', 'email' => '%fred', 'status' => 'published'];
     $query = new SelectQuery($app['storage']->createQueryBuilder(), $app['query.parser.handler']);
     $query->setContentType('pages');
     $query->setParameters($filters);
     $expr = $query->getWhereExpression();
     $this->assertEquals('(pages.username LIKE :username_1) AND (pages.email LIKE :email_1) AND (pages.status = :status_1)', $expr->__toString());
     $this->assertEquals(['%fred%', '%fred', 'published'], array_values($query->getWhereParameters()));
 }