Jarves\Storage\Propel::onlyPrimaryKeySelected PHP Method

onlyPrimaryKeySelected() public method

Checks whether only primary key fields should be selected.
public onlyPrimaryKeySelected ( array $options ) : boolean
$options array with 'fields' item (e.g ['fields' => 'id, name'])
return boolean
    public function onlyPrimaryKeySelected($options)
    {
        if (!isset($options['fields']) || '*' === $options['fields'] || '' === $options['fields']) {
            return false;
        }
        $fields = $options['fields'];
        if ($fields != '*' && is_string($fields)) {
            $fields = explode(',', str_replace(' ', '', trim($fields)));
            $fields = array_map(function ($word) {
                return ucfirst($word);
            }, $fields);
        }
        $primaryKeys = $this->getDefinition()->getPrimaryKeyNames();
        if (count($primaryKeys) !== count($fields)) {
            return false;
        }
        return !array_diff($primaryKeys, $fields);
    }