Add a where clause on the primary key to the query.

@param  mixed  $id
@return $this
438511
public function whereKey($id)
    {
        if (is_array($id) || $id instanceof Arrayable) {
            $this->query->whereIn($this->model->getQualifiedKeyName(), $id);

            return $this;
        }

        return $this->where($this->model->getQualifiedKeyName(), '=', $id);
    }
1108340
public function delete($id)
    {
        $delete = "DELETE FROM " . $this->getTable() . " " .
            "WHERE " . $this->getPrimaryKey() . " = '" . intval($id) . "' LIMIT 1 ;";

        return $this->db->query($delete);
    }
401800
private function first(int $id = null)
    {
        $this->firstIsSelected = true;  // utile pour active record

        if ($id) {
            $this->where('id', '=', $id);
        }

        $this->query->setStartSelect();

        $this->limit(1);

        $this->query->prepare()->bindWhere()->bindLimit()->execute();

        return $this->query->fetch();
    }
158901
public function assignId(int $id): void
    {
        if (isset($this->values[$this->primaryKeyColumn])) {
            return; // This is not an auto-generated key
        }

        $this->values[$this->primaryKeyColumn] = $id;
    }
72641
protected function setWhere()
    {
        $foreign = $this->getForeignKey();

        $parentKey = $this->parentMap->getKeyName();

        $this->query->where($foreign, '=', $this->parent->getEntityAttribute($parentKey));

        return $this;
    }
1173686
private function load($id)
    {
        $fields = $this->getDbConnection()->fetchAssoc('SELECT * FROM `'.$this->objectDefinition->table.'` WHERE id = ?', array($id));
        if (!$fields) throw new \Exception('Object '.$this->objectDefinition->table.':'.$id.' is not found'); 
        $this->setFields($fields);
        $this->_id = $id;
        return $this;
    }
1058111
public function findByPrimaryId($id) {
		if (is_array($id)) {
			$primaty  = $this->getPrimaryName();
			$criteria = $this->getTableModel()->query()->inWhere($primaty, $id);
			
			return $this->find($criteria);
		}
		
		return $this->findFirst($id);
	}
870538
public function where(string $sql, array $params = []) : self
    {
        $this->qiterator = null;
        $this->where[] = [ $sql, $params ];
        return $this;
    }
485200
public function where($where = null, $value = null)
        {
            if (Arrays::is($this->where)) {
                $this->whereKey = count($this->where) + 1;
            }

            $this->where[$this->whereKey]['attr'] = $where;
            $this->where[$this->whereKey]['value'] = $value;

            return $this;
        }
338462
public function findById($id)
    {
        $queryBuilder = $this->createQueryBuilder('a')
            ->addSelect('domains')
            ->leftJoin('a.domains', 'domains')
            ->where('a.id = :id');

        $query = $queryBuilder->getQuery();
        $query->setParameter('id', $id);

        return $query->getSingleResult();
    }
554269
public function setId($id)
    {
        if (!is_int($id) && !is_null($id)) {
            throw new \InvalidArgumentException(__CLASS__ . ' ' . __METHOD__ . ': Not an integer');
        }

        $this->id = $id;

        return $this;
    }
1152002
public function findById($id) {
        $this->sqlBuilder->addWhere($this->primaryKey, $id);
        $sql = $this->sqlBuilder->buildQueryString();
        return $this->db->getOneRow($sql);
    }
895459
public function setId($Id) 
    {
        if (!$this->_isNumericArray($Id)) {
            $Id =  array ($Id);    
        }
        $this->fields['Id']['FieldValue'] = $Id;
        return $this;
    }
458
private static function _setWhere($where, QueryBuilder $query, string $primaryKey = "id") : QueryBuilder
    {
        if(!is_array($where)) {
            return $query->where([
                $primaryKey => $where
            ]);
        }

        $columns = $where;

        unset($columns["ORDER BY"]);
        unset($columns["LIMIT"]);
        unset($columns["OFFSET"]);

        if(!empty($columns)) {
            $query->where($columns);
        }

        if(isset($where["ORDER BY"])) {
            $order = $where["ORDER BY"];
            if(!is_array($order)) {
                $order = [$order];
            }

            $query->order(... $order);
        }
        if(isset($where["LIMIT"])) {
            $limit = $where["LIMIT"];
            if(!is_array($limit)) {
                $limit = [$limit];
            }

            $query->limit(... $limit);
        }
        if(isset($where["OFFSET"])) {
            $query->offset($where["OFFSET"]);
        }

        return $query;
    }
682169
public function where($sql=null, $params=array())
    {
        $this->_where = new Criteria($sql, $params);

        return $this;
    }
105105
public function where($id)
    {
        $this->validateIdentifier($id);

        if (!is_array($id)) {
            $key = reset($this->keys);
            return [$key => $id];
        } else {
            return $id;
        }
    }
1143529
public function newPivotStatementForId($id)
    {
        return $this->newPivotQuery()->whereIn($this->relatedPivotKey, $this->parseIds($id));
    }