Choose to either search database for one row or all rows depending on whether the $id argument is passed

@param int $id
@return mixed
497113
protected static function doSearch($id = null)
    {
        $model = self::createModelInstance();
        $tableName = $model->getTableName($model->className);

        return $id ? self::selectOne($model, $tableName, $id) : self::selectAll($model, $tableName);
    }
327176
public function getOneById($id)
    {
        $id = (string)$id;

        $fields = implode(', ', $this->fields);
        $sql = 'SELECT ' . $fields . ' FROM ' . $this->table . ' WHERE ' . $this->table . '.id = :id';
        $query = $this->pdo->prepare($sql);
        $query->bindParam(':id', $id);
        $query->execute();

        return $query->fetch(PDO::FETCH_ASSOC);
    }
1119835
public function find($id)
    {
        $this->newQuery();

        $this->queryBuilder->whereEqual($this->primaryFieldName, $id);

        $queryKey = $this->queryBuilder->firstQueryKey();

        if (!$this->isCompleteKey($queryKey)) {
            return null;
        }

        list($method, $parameters) = $this->getFindMethodAndParameters();

        array_unshift($parameters, $queryKey);
        $value = call_user_func_array([$this->redClient, $method], $parameters);

        return $value;
    }
763890
private function selectDataById($id)
    {
        $query = "SELECT " . $this->config->getDecodeValueQuery() .
            " as oxvarvalue FROM oxconfig WHERE oxvarname = ? AND oxshopid = ? FOR UPDATE";

        $parameter = [
            self::CONFIG_NAME_FOR_SERVER_INFO.$id,
            $this->config->getBaseShopId()
        ];

        $this->database->setFetchMode(\OxidEsales\Eshop\Core\Database\Adapter\DatabaseInterface::FETCH_MODE_ASSOC);
        return $this->database->getOne($query, $parameter);
    }
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);
	}
1160551
public function findOrFail($id)
    {
        return $this->cache->rememberForever('extension.' . $id, function () use ($id){
            return $this->repository->findOrFail($id);
        });
    }
805483
public function get($id)
    {
        if (!is_array($id)) {
            $index = $this->getIndex();
            $id = $this->db->escape_string($id);
            return $this->build($this->db->select('SELECT * FROM `' . $this->table_name . '` WHERE `' . $index . '` = ? ',
                array($id), $this->getCacheId($id)));
        }
        if (is_array($id)) {
            $fieldsValue = $id;
            $fields = $this->getFields();
            $sql = '';
            $args = array();
            foreach ($fields as $field) {
                if (isset($fieldsValue[$field])) {
                    $args[$field] = $fieldsValue[$field];
                    $sql .= '`' . $field . '` = :' . $field . ' AND ';
                }
            }
            if (!empty($sql)) {
                $sql = substr($sql, 0, -5);
                return $this->build($this->db->select('SELECT * FROM `' . $this->table_name . '` WHERE ' . $sql, $args, $this->getCacheId($id)));
            }
        }
        return $this->build(array());
    }
1208835
public function find($id)
    {
        return $this
            ->getQueryBuilder()
            ->field('id')->equals(new \MongoId($id))
            ->getQuery()
            ->getSingleResult()
        ;
    }
560182
public function has( $id )
	{
		return \DB::select( $this->table )
			->where( 'id', $id )
			->column( 'id', $this->database ) == $id;
	}
322003
public function findById($id)
    {
        $entity = $this->getEntityManager()->getRepository($this->entityClass);
        return $entity->find($id);
    }
346707
protected function getRowKey($id)
    {
        foreach ($this->getData() as $key => $data)
        {
            if ($data->{$this->databaseConfig->getIdentifier()} == $id)
            {
                return $key;
                break;
            }
        }
        throw new \Exception('No data found with ID: ' . $id);
    }
764172
public function findById($id)
    {
        $rowset = $this->getTableGateway()->select(function (Select $select) use($id) {
            $select->columns($this->columns)
            ->where(array(
                'id' => $id
            ))
            ->limit(1);
        });
        $row = $rowset->current();
        if (! $row) {
            return NULL;
        }
        return $row;
    }
813155
public static function find($id) { 
        $array = KernelDB::find(static::$model, $id);
        $routeModel = Dir::apiModel(static::$model);
        return self::arrayToModel($routeModel, $array);
    }
205733
public function find($id)
    {
        return $this->filter(function (Contract $stat) use ($id) {
            return $stat->getSkill()->getId() === $id;
        })->first();
    }
20558
public function find(int $id)
    {
        return $this->cache->tags($this->getModel())->remember($id, 60, function () use ($id) {
            return $this->repository->find($id);
        });
    }
303286
protected function get($id = null)
    {
        $this->filter();

        if ($this->eagerLoad) {
            $this->model = $this->model->with($this->eagerLoad);
        }

        if ($id) {
            return $this->model->where('id', $id)->firstOrFail();
        }

        return $this->model->get();
    }
1311135
function get_search($id)
    {
        $plugin = $this->rc->plugins->exec_hook('saved_search_get', array('id' => $id));

        if ($plugin['abort']) {
            return $plugin['result'];
        }

        $sql_result = $this->db->query(
            "SELECT `name`, `data`, `type`"
            . " FROM ".$this->db->table_name('searches', true)
            . " WHERE `user_id` = ?"
                ." AND `search_id` = ?",
            (int) $this->ID, (int) $id);

        while ($sql_arr = $this->db->fetch_assoc($sql_result)) {
            return array(
                'id'   => $id,
                'name' => $sql_arr['name'],
                'type' => $sql_arr['type'],
                'data' => unserialize($sql_arr['data']),
            );
        }

        return null;
    }