getAttributes() public method

Get the attributes to be selected by the query operation.
public getAttributes ( ) : array | null
return array | null
Example #1
0
 /**
  * Get all the attributes that were selected for the query taking into account all of the aliases used.
  * 
  * @param array $aliases
  * @return array
  */
 protected function getSelectedForAllAliases(array $aliases)
 {
     if (empty($aliases)) {
         $selected = $this->mergeOrderByAttributes($this->getSelectedQueryAttributes($this->operation->getAttributes()));
     } else {
         // If there are aliases, then we need to loop through each one to determine was was actually selected for each.
         $selected = [];
         foreach ($aliases as $alias => $schema) {
             $selected = array_replace($selected, $this->mergeOrderByAttributes($this->getSelectedQueryAttributes($this->operation->getAttributes(), $schema), $alias));
         }
     }
     return $selected;
 }
 /**
  * @param QueryOperation $operation
  */
 protected function hydrateQueryOperation(QueryOperation $operation)
 {
     $operation->setAttributes($this->getAttributesToLdap($operation->getAttributes(), true, $this->schema, $this->alias));
     // Only want it set if it wasn't explicitly set...
     if ($this->schema && is_null($operation->getBaseDn())) {
         $operation->setBaseDn($this->schema->getBaseDn());
     }
     // Empty check instead of null due to the way the BaseDN is set for a RootDSE query...
     if (!empty($operation->getBaseDn()) && ParameterResolver::hasParameters($operation->getBaseDn())) {
         $this->setDefaultParameters();
         $operation->setBaseDn($this->resolveParameters(['baseDn' => $operation->getBaseDn()])['baseDn']);
     }
     // If null then we default to the domain config or the explicitly set value...
     if ($this->schema && !is_null($this->schema->getUsePaging())) {
         $operation->setUsePaging($this->schema->getUsePaging());
     }
     if ($this->schema && !is_null($this->schema->getScope())) {
         $operation->setScope($this->schema->getScope());
     }
     if ($this->schema) {
         $operation->addControl(...$this->schema->getControls());
     }
     if ($operation->getFilter() instanceof OperatorCollection) {
         $this->convertValuesToLdap($operation->getFilter());
         $operation->setFilter($operation->getFilter()->toLdapFilter($this->alias));
     }
 }
 function it_should_not_attempt_to_resolve_parameters_for_a_base_dn_for_the_RootDSE(QueryOperation $operation, $connection)
 {
     $operation->getBaseDn()->willReturn('');
     $operation->getAttributes()->willReturn(['foo']);
     $operation->setAttributes(['foo'])->shouldBeCalled();
     $operation->getFilter()->willReturn('(objectClass=*)');
     $connection->getRootDse()->shouldNotBeCalled();
     $operation->setBaseDn(Argument::any())->shouldNotBeCalled();
     $this->hydrateToLdap($operation);
 }