add() public method

The available parts are: 'select', 'from', 'set', 'where', 'groupBy', 'having' and 'orderBy'.
public add ( string $sqlPartName, string $sqlPart, boolean $append = false )
$sqlPartName string
$sqlPart string
$append boolean
コード例 #1
0
ファイル: QueryBuilder.php プロジェクト: GruppoMeta/Movio
 public function add($sqlPartName, $sqlPart, $append = false)
 {
     if ($sqlPartName == 'select') {
         if (is_array($sqlPart)) {
             $i = 0;
             foreach ($sqlPart as $term) {
                 $sqlPart[$i] = $this->quoteSelectTerm($term);
                 $i++;
             }
         } else {
             $sqlPart = $this->quoteSelectTerm($sqlPart);
         }
     }
     return parent::add($sqlPartName, $sqlPart, $append);
 }
コード例 #2
0
 /**
  * @test
  */
 public function addDelegatesToConcreteQueryBuilder()
 {
     $this->concreteQueryBuilder->add(Argument::exact('select'), Argument::exact('aField'), Argument::cetera())->shouldBeCalled()->willReturn($this->subject);
     $this->subject->add('select', 'aField');
 }
コード例 #3
0
 /**
  * Either appends to or replaces a single, generic query part.
  *
  * The available parts are: 'select', 'from', 'set', 'where',
  * 'groupBy', 'having' and 'orderBy'.
  *
  * @param string $sqlPartName
  * @param string $sqlPart
  * @param bool $append
  *
  * @return QueryBuilder This QueryBuilder instance.
  */
 public function add(string $sqlPartName, string $sqlPart, bool $append = false) : QueryBuilder
 {
     $this->concreteQueryBuilder->add($sqlPartName, $sqlPart, $append);
     return $this;
 }
コード例 #4
0
 /**
  * @covers Kunstmaan\AdminBundle\Helper\Security\Acl\AclNativeHelper::apply
  */
 public function testApplyAnonymous()
 {
     $queryBuilder = new QueryBuilder($this->conn);
     $queryBuilder->add('from', array(array('table' => 'myTable', 'alias' => 'n')));
     $roles = array();
     $this->token->expects($this->once())->method('getRoles')->will($this->returnValue($roles));
     $this->rh->expects($this->once())->method('getReachableRoles')->with($roles)->will($this->returnValue($roles));
     $this->token->expects($this->any())->method('getUser')->will($this->returnValue('anon.'));
     $permissionDef = new PermissionDefinition(array('view'), 'Kunstmaan\\NodeBundle\\Entity\\Node', 'n');
     /* @var $qb QueryBuilder */
     $qb = $this->object->apply($queryBuilder, $permissionDef);
     $query = $qb->getSQL();
     $this->assertContains('"IS_AUTHENTICATED_ANONYMOUSLY"', $query);
 }
コード例 #5
0
ファイル: SqlQueryBuilder.php プロジェクト: Maksold/platform
 /**
  * Either appends to or replaces a single, generic query part.
  *
  * The available parts are: 'select', 'from', 'set', 'where',
  * 'groupBy', 'having' and 'orderBy'.
  *
  * @param string  $sqlPartName
  * @param string  $sqlPart
  * @param boolean $append
  *
  * @return self
  */
 public function add($sqlPartName, $sqlPart, $append = false)
 {
     $this->qb->add($sqlPartName, $sqlPart, $append);
     return $this;
 }