public function addUser($conexion, $email, $nombre, $apellido, $edad, $genero, $grado, $password)
 {
     $roll = 3;
     $active = 0;
     $query = new Query();
     $query->add($this->table, $conexion, $email, $nombre, $apellido, $edad, $genero, $grado, $password, $roll, $active);
 }
Example #2
0
 function add($params)
 {
     $game = new Game();
     foreach ($game as $key => $value) {
         if (isset($params[$key])) {
             $game->{$key} = $params[$key];
         }
     }
     $game = Query::add($game);
     return $game;
 }
Example #3
0
 function add($params)
 {
     $arena = new Arena();
     foreach ($arena as $key => $value) {
         if (isset($params[$key])) {
             $arena->{$key} = $params[$key];
         }
     }
     $arena = Query::add($arena);
     return $arena;
 }
Example #4
0
 function add($params)
 {
     $user = new User();
     foreach ($user as $key => $value) {
         if (isset($params[$key])) {
             $user->{$key} = $params[$key];
         }
     }
     $user = Query::add($user);
     return $user;
 }
Example #5
0
    function testGetTablesClauseMultipleTablesWithJoin()
    {
        $q = new Query('Article');
        $q->join('UserCard', 'Article.CardID = UserCard.CardID AND UserCard.UserID = 2', Query::LEFT_JOIN);
        $q->add('UserCard.CardID', null, Query::IS_NULL);
        $q->join('CardPicture');
        $q->group('Article.CardID');
        $q->addOrder('Title', 'DESC');
        $this->assertEquals(preg_replace('/\\s/', '', 'SELECT `Article`.*
FROM (`Article`, `CardPicture`)
LEFT JOIN `UserCard` ON (Article.CardID = UserCard.CardID AND UserCard.UserID = 2)
WHERE `UserCard`.`CardID` IS NULL
GROUP BY `Article`.`CardID`
ORDER BY `Title` DESC'), preg_replace('/\\s/', '', $q->getQuery() . ''));
    }
<?php

//New query
$q = new Query();
$q->add('Column', 'Value');
//Limit results per page
$limit = 50;
//Specify the current page
$page = 2;
//Create instance of pager, provide the name of the DABL class
$pager = new QueryPager($q, $limit, $page, 'Inspection');
//Retrieve an array of Objects from the DABL class for that page
$inspections = $pager->fetchPage();
Example #7
0
 /**
  * @param string $foreign_table
  * @param string $foreign_column
  * @param Query $q
  * @return Query
  */
 protected function getForeignObjectsQuery($foreign_table, $foreign_column, $local_column, Query $q = null)
 {
     $value = $this->{"get{$local_column}"}();
     if (null === $value) {
         throw new RuntimeException('NULL cannot be used to match keys.');
     }
     $column = "{$foreign_table}.{$foreign_column}";
     if ($q) {
         $q = clone $q;
         $alias = $q->getAlias();
         if ($alias && $foreign_table == $q->getTable()) {
             $column = "{$alias}.{$foreign_column}";
         }
     } else {
         $q = new Query();
     }
     $q->add($column, $value);
     return $q;
 }