@param int|string $pk

@return null|Model
328408
public function load($pk) {
        X::logger()->trace("Redis cached load $pk");
        $key = $this->getPoolKey($pk);
        /** @noinspection UnserializeExploitsInspection */
        $model = @unserialize($this->redis()->get($key));

        if ($model instanceof Model) {
            X::logger()->trace("Hit load $key");
            if ($model->isNewRecord || count($model->modified) > 0) {
                X::logger()->warn("The cache of {$model->tableName}-{$model->pk} is polluted");
                return $this->loadFromDb($pk);
            }
            return $this->model->setup($model->properties);
        }

        X::logger()->trace("Miss load $key");
        return $this->loadFromDb($pk);
    }
399882
public function getKey()
    {
        $pk = $this->getPk();
        if (is_string($pk) && array_key_exists($pk, $this->data)) {
            return $this->data[$pk];
        }

        return;
    }
691642
public function deleteByPK(array $primary_key)
    {
        $where = $this
            ->checkPrimaryKey($primary_key)
            ->getWhereFrom($primary_key)
        ;

        return $this->deleteWhere($where)->current();
    }
970582
protected function realPkSelection(&$pk)
  {
    if ( null === $pk ){
      $pk = $this->row->get($this->tbl_key);
    }
    
    if ( null === $pk ){
      $this->setError( DatabaseHelper::getTranslation('NO_ITEM_SELECTED') );
      return false;
    }
    
    return true;
  }
476151
public function get($p_key, $p_default = false)
    {
        return $this->getValue($p_key, $this->getAsArray(), $p_default);
    }
270576
public function remove($pk = null) {
        X::logger()->trace('Redis cached remove');
        $result = DirectModelManager::getInstance($this->model)->remove($pk);
        $this->removeAllRelatedCache();
        return $result;
    }
328466
public function find( $key, $disableLateLoading = null )
    {

        // $disableLateLoading default value management
        if( !is_bool( $disableLateLoading ) ) {
            $disableLateLoading = false;
        }

        // empty key
        if( is_null( $key ) or !is_scalar( $key ) or strlen( trim( $key ) ) === 0 ) {
            return null;
        }

        $class = $this->entityClass;

        try {
            return $this->entityFactory( $key, $disableLateLoading );
        } catch( \Exception $e ) {
            return null;
        }

    }
611543
public function getItem($pk = null)
	{
		if ($result = parent::getItem($pk))
		{
			// Prime required properties.
			if (empty($result->id))
			{
				$result->parent_id = $this->getState('category.parent_id');
				$result->extension = $this->getState('category.extension');
			}

			// Convert the metadata field to an array.
			$registry = new Registry;
			$registry->loadString($result->metadata);
			$result->metadata = $registry->toArray();

			// Convert the created and modified dates to local user time for display in the form.
			$tz = new DateTimeZone(JFactory::getApplication()->get('offset'));

			if ((int) $result->created_time)
			{
				$date = new JDate($result->created_time);
				$date->setTimezone($tz);
				$result->created_time = $date->toSql(true);
			}
			else
			{
				$result->created_time = null;
			}

			if ((int) $result->modified_time)
			{
				$date = new JDate($result->modified_time);
				$date->setTimezone($tz);
				$result->modified_time = $date->toSql(true);
			}
			else
			{
				$result->modified_time = null;
			}
		}

		$assoc = $this->getAssoc();

		if ($assoc)
		{
			if ($result->id != null)
			{
				$result->associations = ArrayHelper::toInteger(CategoriesHelper::getAssociations($result->id, $result->extension));
			}
			else
			{
				$result->associations = array();
			}
		}

		return $result;
	}
324496
public function getMemberByKey($key)
    {
        $timeStamp = time();
        $result = $this->em->getRepository($this->entity['m']['name'])->findOneBy(array('key_activation' => $key));
        if (is_null($result)) {
            return new ModelResponse($result, 0, 0, null, true, 'E:D:002', 'Unable to find request entry in database.', $timeStamp, time());
        }
        return new ModelResponse($result, 1, 0, null, false, 'S:D:002', 'Entries successfully fetched from database.', $timeStamp, time());
    }
692891
public function getEntityByPk($entity, $pk, $cols = null)
    {
        // TODO: rename PK to ID
        $tbl = $this->resource->getTableName($entity);
        /* columns to select */
        $cols = ($cols) ? $cols : '*';
        $query = $this->conn->select();
        $query->from($tbl, $cols);
        foreach (array_keys($pk) as $field) {
            $query->where("$field=:$field");
        }
        $result = $this->conn->fetchRow($query, $pk);
        return $result;
    }
1062912
public function get($pKey)
    {
        $file = $this->_loadFile($pKey);

        if (isset($this->_files[$file][$pKey]) and $this->_checkTtl($file, $pKey)) {
            return $this->_files[$file][$pKey][static::AGL_CACHE_VALUE];
        }

        return NULL;
    }
855040
protected function buildPKConditions($pk, $_data){
        if(is_string($pk)){
            $pks = array($pk);
            if(!is_array($_data)){
                $_data = array($pk => $_data);
            }
        }
        else{
            $pks = $pk;
        }
        $params = array();
        foreach($pks as $k => $pk){
            $pks[$k] = $pk.'=:pk'.$k;
            $params[':pk'.$k] = $_data[$pk];
        }
        array_unshift($pks, 'AND');
        
        return array($pks, $params);
    }
1248891
public function getPk($options = '')
    {
        if (!empty($this->pk)) {
            $pk = $this->pk;
        } else {
            $pk = $this->getTableInfo(is_array($options) ? $options['table'] : $options, 'pk');
        }
        return $pk;
    }
701502
public function getPKType() {
        if ($this->_pktype === null) {
            if ($this->_pk === null) {
                $this->getPK();
            }
            $this->_pktype= $this->xpdo->getPKType($this->_class);
        }
        return $this->_pktype;
    }
289263
protected function getQuantity(array $insertedPKs)
    {
        if (is_int($this->quantity)) {
            return $this->quantity;
        }

        if ($this->quantity === 'random') {
            return mt_rand(0, count($insertedPKs[$this->relatedClass]));
        }

        return count($insertedPKs[$this->relatedClass]);
    }
867208
private static function persistenceLoadDefault($pk, $table, $options){
    if ( $data = SQL::single("SELECT * FROM $table WHERE {$options['key']}=? LIMIT 1",[$pk]) ){
       $obj = new static;
       foreach ((array)$data as $key => $value) {
         $obj->$key = $value;
       }
       if (is_callable(($c=get_called_class())."::trigger")) $c::trigger("load", $obj, $table, $options['key']);
       return $obj;
     } else {
       return null;
     }
  }
679726
public function getPk ()
	{
		
		// If there is no database table return FALSE

		if (!$this->get ('table'))
		{
			return FALSE;
		}

		// Create new database tool

		$db	= new Db;

		// Get primary key field

		return $db->getPrimaryKey ($this->get ('database'), $this->get ('table'));
		
	}