Sets mapper in mapper array for reuse.

@param string $mapperClass
@param array $options
@return $this
976288
public function setMapper($mapperClass, array $options = [])
    {
        $sl             = $this->getServiceLocator();
        $mapperManager  = $sl->get(MapperManager::class);

        $defaultOptions = [
            'model' => $this->model ?? $this->serviceAlias,
            'hydrator' => $this->hydrator ?? $this->serviceAlias,
        ];

        $options    = array_merge($defaultOptions, $options);
        $mapper     = $mapperManager->get($mapperClass, $options);

        $this->mappers[$mapperClass] = $mapper;

        return $this;
    }
1115757
public function addMapper(ResultMapperInterface $mapper)
    {
        if ($mapper instanceof self) {
            return $this->addMappers($mapper->mappers);
        }

        $this->mappers[] = $mapper;
    
        return $this;
    }
749761
public function setMappedSuperClass()
    {
        $this->cm->isMappedSuperclass = true;
        $this->cm->isEmbeddedClass = false;

        return $this;
    }
585793
public function setOptions(array $options)
    {
        if ($this->options && is_array($options)) {
            $options = ArrayUtils::merge($this->options, $options);
        }

        $this->options = $options;

        return $this;
    }
1210137
public function setOptions(OptionsInterface $options = null)
    {
        if (null !== $options && !$options instanceof Options) {
            $options = new Options($options->toArray());
        }

        $this->options = $options;
        return $this;
    }
749334
public function setOptions($options)
	{
		$options = is_array($options) ? $options : array($options);

		foreach ($options as $option)
		{
			$this->addOption($option);
		}

		return $this;
	}
520528
public function setOptions(array $options)
    {
        foreach ($options as $k => $v) {
            $this->_options[$k] = $v;
        }
        return $this;
    }
962218
public function hasAnyClass($classes, array $options)
    {
        $options += ['class' => []];

        $options['class'] = $this->_toClassArray($options['class']);
        $classes = $this->_toClassArray($classes);

        foreach ($classes as $class) {
            if (in_array($class, $options['class'])) {
                return true;
            }
        }

        return false;
    }
1189316
final public function addOverride($class, $type, array $options)
    {
        if (!isset($this->overrides[$class])) {
            $this->overrides[$class] = [];
        }

        $this->overrides[$class][$type] = $options;
    }
617967
public function setOptions(array $options = [], $reset = false)
    {
        return $this->setQuery(current($options))
            ->setField(next($options))
            ->setId(next($options))
            ->setMessage(next($options));
    }
730908
public function setTypeMapping($type, $class = null)
    {
        if (is_string($type)) {
            if ($class === null) {
                throw new InvalidArgumentException(
                    'If $type is specified, $class is required'
                );
            }
            $type = array($type => (string) $class);
            $class = null;
        }

        if (!is_array($type)) {
            throw new InvalidArgumentException(
                'Type must either be an array or a string.'
            );
        }

        if ($class !== null) {
            throw new InvalidArgumentException(
                'If $type is an array, $class must not be specified.'
            );
        }

        $this->type_map = array_merge($this->type_map, $type);
    }
898080
protected function _addClass(FormHelper $formHelper, $options, $class)
    {
        $bootstrap = isset($options['bootstrap']) ? (bool)$options['bootstrap'] : true;
        if ($bootstrap) {
            $options = $formHelper->addClass((array)$options, $class);
        }

        if (isset($options['bootstrap'])) {
            unset($options['bootstrap']);
        }

        return $options;
    }
577682
public function setIteratorClass($class)
    {
        $reflection = new ReflectionClass($class);
        if (
            !$reflection->implementsInterface('Traversable') &&
            !$reflection->implementsInterface('Iterator')
        ) {
            // The provided class is not an iterator or traversable
            throw new InvalidArgumentException(
                "The class {$class} does not implement Traversable or " .
                "Iterator interfaces"
            );
        }

        $this->_iteratorClass = $class;
        return $this;
    }
472480
public function set($key, $value)
    {
        if (! $value instanceof EntityMapperInterface) {
            throw new InvalidArgumentException(
                'Trying to add a non EntityMapper to MappersMap.'
            );
        }
        return parent::set($key, $value);
    }
513352
public function setOptions(array $options)
    {
        // Set namespace first, see ZF-10836
        if (isset($options['namespace'])) {
            $this->setNamespace($options['namespace']);
            unset($options['namespace']);
        }

        $methods = get_class_methods($this);
        foreach ($options as $key => $value) {
            $method = 'set' . ucfirst($key);
            if (in_array($method, $methods)) {
                $this->$method($value);
            }
        }
        return $this;
    }
992491
public function asModel($class, $options = [])
    {
        $m = $this->newInstance($class, $options);

        foreach ($this->data as $field=> $value) {
            if ($value !== null && $value !== $this->getField($field)->default) {

                // Copying only non-default value
                $m[$field] = $value;
            }
        }

        // next we need to go over fields to see if any system
        // values have changed and mark them as dirty

        return $m;
    }
420591
protected function assignPrimaryKey(array & $mappers)
    {
        $foundPrimary = false;

        foreach ($mappers as $mapper) {
            if ($foundPrimary) {
                $mapper->field->isPrimary = false;
                $mapper->field->isAutoIncrement = false;
                continue;
            }

            if ($mapper->field->isPrimary()) {
                $mapper->field->isPrimary = true;
                $foundPrimary = true;
            }
        }

        return $this;
    }