Elgg\Database\PrivateSettingsTable::get PHP Method

get() public method

Plugin authors can set private data on entities. By default private data will not be searched or exported.
public get ( integer $entity_guid, string $name ) : mixed
$entity_guid integer The entity GUID
$name string The name of the setting
return mixed The setting value, or null if does not exist
    public function get($entity_guid, $name)
    {
        $values = $this->cache->getAll($entity_guid);
        if (isset($values[$name])) {
            return $values[$name];
        }
        if (!$this->entities->exists($entity_guid)) {
            return false;
        }
        $query = "\n\t\t\tSELECT value FROM {$this->table}\n\t\t\tWHERE name = :name\n\t\t\tAND entity_guid = :entity_guid\n\t\t";
        $params = [':entity_guid' => (int) $entity_guid, ':name' => (string) $name];
        $setting = $this->db->getDataRow($query, null, $params);
        if ($setting) {
            return $setting->value;
        }
        return null;
    }