t('Config Scope Module'), 'name' => t('Config Scope Name'), 'hash' => t('Config Scope Hash') ]; } public function getSearchColumns() { return ['name']; } public function getDefaultSort() { return 'icingaweb_config_scope.name'; } public function createBehaviors(Behaviors $behaviors) { $binary = new class (['hash']) extends PropertyBehavior implements QueryAwareBehavior { public function setQuery(Query $query) { if (! $query->getDb()->getAdapter() instanceof Pgsql) { $this->properties = []; } } public function fromDb($value, $key, $context) { if ($value !== null) { if (! is_resource($value)) { throw new \UnexpectedValueException( sprintf('%s should be a resource got %s instead', $key, get_php_type($value)) ); } return stream_get_contents($value); } return null; } public function toDb($value, $key, $context) { if (is_resource($value)) { throw new \UnexpectedValueException(sprintf('Unexpected resource for %s', $key)); } return sprintf('\\x%s', bin2hex($value)); } }; $behaviors->add($binary); } public function createRelations(Relations $relations) { $relations->hasMany('option', ConfigOption::class) ->setForeignKey('scope_id') ->setJoinType('LEFT'); } }