Get object with primary key

@param int $id
@param bool $ignore_cache
@return mixed|null
336443
public function get($id, $ignore_cache = false){
        if( empty($this->primary_key) ){
            return null;
        }
        $row = $this->where("{$this->table}.{$this->primary_key} = %d", $id)->get_row('', $ignore_cache);
        if( $row && $this->result_class ){
            return new $this->result_class($row);
        }else{
            return $row;
        }
    }
189785
public function getUpdateRequest($id, $updateBind)
    {
        $self = $this;
        $updateBind = [$this->primaryKey => $id] + $updateBind;
        $request = new StorageDataRequest(
            [$id, $updateBind],
            function ($id, $bind) use ($self) {
                $pointer = $self->getPointer($id, self::UPDATE_ACCESS);
                if (!$pointer) {
                    return null;
                }
    
                $record = json_decode(stream_get_contents($pointer), true);
                if (isset($record[self::F_DATA])) {
                    $bind += $record[self::F_DATA];
                }
                ftruncate($pointer, 0);
                rewind($pointer);
                $res = fwrite($pointer, $this->_packData($bind));
                $self->closePointer($pointer);
                return $res ? $bind : null;
            }
        );
    
        return $request;
    }
642908
function get_by_id($id, $ammend_query = '')
	{
		if (isset(self::$_cache[$this->_table][$id])) {
			//var_dump(self::$_cache[$this->_table][$id]);
			return self::$_cache[$this->_table][$id];
		}

		$q = \Fw\Db::prepare("select * from " . $this->_table . " where id=? " . $ammend_query);
		$q->execute(array($id));
		$res = $q->fetchObject($this->_entity);
		self::$_cache[$this->_table][$id] = $res;

		return $res;
	}
984730
public function get( $id, $field = '' ){
		$field	= $this->checkField( $field, FALSE, TRUE );
		$data	= $this->cache->get( $this->cacheKey.$id );
		if( !$data ){
			$this->table->focusPrimary( $id );
			$data	= $this->table->get( TRUE );
			$this->table->defocus();
			$this->cache->set( $this->cacheKey.$id, $data );
		}
		if( strlen( trim( $field ) ) )
			return $this->getFieldsFromResult( $data, array( $field ) );
		return $data;
	}
1326359
public static SystemConfiguration get(final long _id)
        throws CacheReloadException
    {
        final Cache<Long, SystemConfiguration> cache = InfinispanCache.get().<Long, SystemConfiguration>getCache(
                        SystemConfiguration.IDCACHE);
        if (!cache.containsKey(_id)) {
            SystemConfiguration.getSystemConfigurationFromDB(SystemConfiguration.SQL_ID, _id);
        }
        return cache.get(_id);
    }
207762
private function getCacheEntity($id)
    {
        $contextual_id = $this->getContextualId($id);

        if (null === $this->_entity || $this->_entity->getId() !== $contextual_id) {
            $this->_entity = $this->_repository->find($contextual_id);
        }

        return $this->_entity;
    }
632770
public function get($cache_id, $return_data_only = false) {
		$result = $this->object->get($cache_id);
		// if we are debugging
		if (\Debug::$debug) {
			\Debug::$data['cache'][] = array(
				'type' => 'get',
				'link' => $this->object->cache_link,
				'cache_id' => $cache_id,
				'have_data' => $result['success']
			);
			// todo: log errors
		}
		// if we need to return data
		if ($return_data_only) {
			if ($result['success']) {
				return $result['data'];
			} else {
				return false;
			}
		} else {
			return $result;
		}
	}
674905
public static function getCacheKeyById($id, $keys = false)
    {
        if (is_array($id)) {
            ksort($id);
            $id = ($keys) ? array_keys($id) : array_values($id);

            return implode('|', $id);
        }

        return (string)$id;
    }
1309745
private function getCachedReachableRoles($id, &$item)
    {
        $roles = null;

        // find the hierarchy in execution cache
        if (isset($this->cacheExec[$id])) {
            return $this->cacheExec[$id];
        }

        // find the hierarchy in cache
        if (null !== $this->cache) {
            $item = $this->cache->getItem($id);
            $reachableRoles = $item->get();

            if ($item->isHit() && null !== $reachableRoles) {
                $roles = $reachableRoles;
            }
        }

        return $roles;
    }
728892
function get_record($id, $assoc = false)
    {
        // return cached result
        if ($this->result && ($first = $this->result->first()) && $first[$this->primary_key] == $id) {
            return $assoc ? $first : $this->result;
        }

        $this->db->query(
            "SELECT * FROM " . $this->db->table_name($this->db_name, true).
            " WHERE `contact_id` = ?".
                " AND `user_id` = ?".
                " AND `del` <> 1",
            $id,
            $this->user_id
        );

        $this->result = null;

        if ($sql_arr = $this->db->fetch_assoc()) {
            $record = $this->convert_db_data($sql_arr);
            $this->result = new rcube_result_set(1);
            $this->result->add($record);
        }

        return $assoc && $record ? $record : $this->result;
    }
415707
public function getById($id, $col = null)
    {
        $id = (int) $id;
        $model = $this->getCacheItem($id);

        if (!$model) {
            $model = $this->getMapper()->getById($id, $col);

            if ($this->useCache) {
                $this->setCacheItem($id, $model);
            }
        }

        return $model;
    }
1130642
public static function getByID($id)
    {
        $record = static::getRecordByField(static::$primaryKey ? static::$primaryKey : 'ID', $id, true);

        return static::instantiateRecord($record);
    }
85625
public function &get($name, $ignore_error = false)
    {
        if (!array_key_exists($name, $this->_storage)) {
            if (!$ignore_error) {
                trigger_error(
                    "Attempted to retrieve non-existent variable $name",
                    E_USER_ERROR
                );
            }
            $var = null; // so we can return by reference
            return $var;
        }
        return $this->_storage[$name];
    }
338756
public function findCacheById(int $id, int $siteId = null)
    {

        // Resolve siteId
        $siteId = SiteHelper::resolveSiteId($siteId);

        // Check if already in addToCache
        if ($this->isCachedById($id, $siteId)) {
            return $this->cacheById[$siteId][$id];
        }

        return null;
    }
834352
public static Association get(final long _id)
        throws CacheReloadException
    {
        final Cache<Long, Association> cache = InfinispanCache.get().<Long, Association>getCache(Association.IDCACHE);
        if (!cache.containsKey(_id) && !Association.getAssociationFromDB(Association.SQL_ID, _id)) {
            cache.put(_id, Association.NULL, 100, TimeUnit.SECONDS);
        }
        final Association ret = cache.get(_id);
        return ret.equals(Association.NULL) ? null : ret;
    }
751687
public Object get(Id id, Mode mode) {
        Object value = writeCache.get(id);
        if (value == null) {
            value = readCache.get(new CacheKey(id));
            if (value != null && Mode.WRITE.equals(mode)) {
                writeCache.put(id, value);
            }
        }
        return value;
    }
286073
public function getVazby($id = null)
    {
        if (is_null($id)) {
            $id = $this->getRecordID();
        }
        if (!empty($id)) {
            $vazbyRaw = $this->getColumnsFromFlexibee(['vazby'],
                ['relations' => 'vazby', 'id' => $id]);
            $vazby    = array_key_exists('vazby', $vazbyRaw[0]) ? $vazbyRaw[0]['vazby']
                    : null;
        } else {
            throw new \Exception(_('ID requied to get record relations '));
        }
        return $vazby;
    }