/**
* Get the filter for the schema object.
*
* @param LdapObjectSchema $objectSchema
* @param array $objectArray
* @return \LdapTools\Query\Operator\BaseOperator
* @throws SchemaParserException
*/
protected function parseFilter(LdapObjectSchema $objectSchema, array $objectArray)
{
$filter = array_key_exists('filter', $objectArray) ? $objectArray['filter'] : [];
if (empty($filter) && empty($objectSchema->getObjectClass()) && empty($objectSchema->getObjectCategory())) {
throw new SchemaParserException(sprintf('Object type "%s" must have one of the following defined: %s', $objectSchema->getObjectType(), implode(', ', ['class', 'category', 'filter'])));
}
return $this->arrayToOp->getOperatorForSchema($objectSchema, $filter);
}