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
Exemplo n.º 1
0
 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);
 }
 /**
  * @test
  */
 public function addDelegatesToConcreteQueryBuilder()
 {
     $this->concreteQueryBuilder->add(Argument::exact('select'), Argument::exact('aField'), Argument::cetera())->shouldBeCalled()->willReturn($this->subject);
     $this->subject->add('select', 'aField');
 }
Exemplo n.º 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;
 }
 /**
  * @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);
 }
Exemplo n.º 5
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 boolean $append
  *
  * @return self
  */
 public function add($sqlPartName, $sqlPart, $append = false)
 {
     $this->qb->add($sqlPartName, $sqlPart, $append);
     return $this;
 }