LdapTools\Hydrator\HydrateQueryTrait::getAttributesToLdap PHP Метод

getAttributesToLdap() защищенный Метод

Performs the logic needed to determine what attributes were actually selected, or should be selected, when going to LDAP and whether they should be returned as schema translated names.
protected getAttributesToLdap ( array $attributes, $translate, LdapObjectSchema $schema = null, null | string $alias = null ) : array
$attributes array
$schema LdapTools\Schema\LdapObjectSchema
$alias null | string
Результат array
    protected function getAttributesToLdap(array $attributes, $translate, LdapObjectSchema $schema = null, $alias = null)
    {
        // First determine if this was some sort of wildcard selection
        $attributes = $this->getSelectedQueryAttributes($attributes, $schema);
        // This will return only the attributes for the current alias, minus the possible alias prefix.
        if ($schema) {
            $attributes = $this->getAttributesForAlias($attributes, $alias);
        }
        // If we still have an empty array here, then fill it with the defaults because nothing was selected specifically.
        if ($schema && empty($attributes)) {
            $attributes = $schema->getAttributesToSelect();
        }
        // At this point we add any orderBy attributes that are not being specifically selected already.
        if (!empty($this->orderBy)) {
            $attributes = $this->mergeOrderByAttributes($attributes, $alias);
        }
        if ($schema && $translate) {
            $newAttributes = [];
            foreach ($attributes as $attribute) {
                $newAttributes[] = $schema->getAttributeToLdap($attribute);
            }
            $attributes = $newAttributes;
        }
        return $attributes;
    }