Set the mapper current tab.

@param  string          $name
@param  string|callable $mapper

@access public
@return void
5532
public function tab($name, $mapper)
	{
		$this->tab = $name;

		if ($mapper instanceof Closure) {
			$mapper($this);
		}
	}
333429
public function setChildren($children, $mapper = null)
    {
        $element = clone $this;

        $element->children = new Collection();

        return $element->addChildren($children, $mapper);
    }
737415
public function setAttribute($name, $value)
	{
		$this->model->$name = $value;
		if (!in_array($name, $this->changedAttributes)) {
			$this->changedAttributes[] = $name;
		}
	}
174033
public function setAdapter($name, AdapterInterface $adapter)
    {
        $this->adapters[$name] = $adapter;
        $this->adapterClasses[$name] = get_class($adapter);
    }
314674
public static function setDB($name, DBAdapter $adapter)
    {
        if ($name === null) {
            $name = self::getDefaultDB();
        }
        self::$adapterMap[$name] = $adapter;
    }
614942
private void setMappers(ObjectMapper mapper, XmlMapper xml) {
        synchronized (lock) {
            this.mapper = mapper;
            this.xml = xml;
            // mapper and xml are set to null on invalidation.
            if (mapper != null && xml != null) {
                applyMapperConfiguration(mapper, xml);
            }
        }
    }
609073
public function setMappers($mappers) {
    $this->mappers = $mappers;
    foreach ($mappers as $fqName => $mapper) {
      // register simple type names
      $name = $this->calculateSimpleType($fqName);
      if (!isset($this->mappers[$name])) {
        $this->mappers[$name] = $mapper;
        if (!isset($this->simpleToFqNames[$name])) {
          $this->simpleToFqNames[$name] = $fqName;
        }
        else {
          // if the simple type name already exists, we remove
          // it in order to prevent collisions with the new type
          unset($this->simpleToFqNames[$name]);
        }
      }
      // set logging strategy
      $mapper->setLogStrategy($this->logStrategy);
    }
  }
747634
public function usePdo($name)
    {
        if (!isset($this->connections[$name])) {
            $name   = $this->defaultPdoName;
        }

        $pdo = $this->getPdo($name);
        $this->setActivePdo($pdo);
    }
700281
public function addDiscriminatorMapClass($name, string $className) : void
    {
        $this->discriminatorMap[$name] = $className;

        if ($this->className === $className) {
            $this->discriminatorValue = $name;

            return;
        }

        if (! (class_exists($className) || interface_exists($className))) {
            throw MappingException::invalidClassInDiscriminatorMap($className, $this->className);
        }

        if (is_subclass_of($className, $this->className) && ! in_array($className, $this->subClasses, true)) {
            $this->subClasses[] = $className;
        }
    }
292716
public static function setPlaceholderFormatterDefinition(string $name, callable $callable): void
    {
        if (!self::$formatters) {
            self::$formatters = self::initPlaceholderFormatters();
        }

        self::$formatters[$name] = $callable;
    }
129581
public function set($name, $value)
    {
        self::preSet($name, $value);

        $this->_container[$name] = $value;
    }
826232
public function setListMapper(ListMapper $mapper)
	{
		$this->listMapper = $mapper;
		$mapper->setAdmin($this);
		return $this;
	}
83026
protected function setMapper(QueryMapperInterface $mapper = null): self
    {
        if (is_null($mapper)) {
            return $this->setDefaultMapper();
        }
        
        $this->mapper = $mapper;
        
        return $this;
    }
455087
protected function setFormParameter(string $name, string $value): void
    {
        $this->formParameters->set($name, $value);
    }
439818
public function set($name, $value)
    {
        if (null !== $this->parser) {
            list($name, $value) = call_user_func($this->parser, $name, $value);
        }

        $this->options[$name] = $value;
    }
196724
public static function set(string $name, callable $callback)
    {
        if ($name = \trim($name)) {
            self::$validators[$name] = $callback;
        }
    }
982450
protected function addContent(BaseMapper $mapper, $group)
    {
        // helper links
        $this->parseHelperLinks();

        // flat organization (DatagridMapper / ListMapper...)
        if (!$mapper instanceof BaseGroupedMapper) {
            //list actions
            $this->addActions();
            $this->removeActions();

            // options pre-treatment
            $options = [];
            if (isset($group['_options'])) {
                $options = $group['_options'];
                unset($group['_options']);
            }

            // content
            foreach ($group as $add => $opts) {
                $this->addField($mapper, $add, $opts);
            }

            // options
            if (isset($options['fieldsOrder'])) {
                $mapper->reorder($options['fieldsOrder']);
            }

            // extra templates
            $this->parseExtraTemplates();

            return $mapper;
        }

        $fcts = [
            'tabs' => $mapper instanceof ShowMapper ?
            ['getter' => 'getShowTabs', 'setter' => 'setShowTabs'] :
            ['getter' => 'getFormTabs', 'setter' => 'setFormTabs'],
            'groups' => $mapper instanceof ShowMapper ?
            ['getter' => 'getShowGroups', 'setter' => 'setShowGroups'] :
            ['getter' => 'getFormGroups', 'setter' => 'setFormGroups'],
        ];

        // if a grouped organization can be shapped
        // options
        $tabsOptions = null;
        if (isset($group['_options'])) {
            $tabsOptions = $group['_options'];
            unset($group['_options']);
        }

        // content
        foreach ($group as $tab => $tabcontent) { // loop on content...
            if (self::arrayDepth($tabcontent) < 1) {
                // direct add
                $this->addField($mapper, $tab, $tabcontent);
                $mapper->end()->end();
            } else {
                // groups/withs order
                $groupsOrder = null;
                if (isset($tabcontent['_options']['groupsOrder'])) {
                    $groupsOrder = $tabcontent['_options']['groupsOrder'];
                    unset($tabcontent['_options']['groupsOrder']);
                }

                $endgroup = $endtab = false;

                // tab
                if (!empty($tabcontent['_options']['hideTitle']) || $mapper instanceof ShowMapper && !$this->forceTabs) {
                    // display tabs as groups
                    $tabs = $this->{$fcts['tabs']['getter']}();
                    $groups = $this->{$fcts['groups']['getter']}();
                    if (isset($tabs[$tab])) {
                        $tabs[$tab]['auto_created'] = true;
                        $this->{$fcts['tabs']['setter']}($tabs);

                        foreach ($groups as $groupkey => $group) {
                            if (!isset($groups[$group['name']])) {
                                $groups[$group['name']] = $group;
                                unset($groups[$groupkey]);
                            }
                        }
                        $this->{$fcts['groups']['setter']}($groups);
                    }
                } else {
                    $mapper->tab($tab, isset($tabcontent['_options']) ? $tabcontent['_options'] : []);
                    $endtab = true;
                }

                // adding count of collections items in tab
                if (isset($tabcontent['_options']['countChildItems']) && is_array($tabcontent['_options']['countChildItems'])) {
                    $tabs = $this->{$fcts['tabs']['getter']}();
                    if (strpos($tabs[$tab]['class'], 'countable-tab') === false) {
                        $tabs[$tab]['class'] .= ' countable-tab';

                        foreach ($tabcontent['_options']['countChildItems'] as $fieldToCount) {
                            if (strpos($tabs[$tab]['class'], 'count-' . $fieldToCount) === false) {
                                $tabs[$tab]['class'] .= ' count-' . $fieldToCount;
                            }
                        }

                        $this->{$fcts['tabs']['setter']}($tabs);
                    }
                }

                // clearing tabcontent options
                if (isset($tabcontent['_options'])) {
                    unset($tabcontent['_options']);
                }

                $finalOrder = null;

                // with
                if (self::arrayDepth($tabcontent) > 0) {
                    foreach ($tabcontent as $with => $withcontent) {
                        $opt = isset($withcontent['_options']) ? $withcontent['_options'] : [];
                        $finalOrder = (isset($opt['fieldsOrder']) ? $opt['fieldsOrder'] : null);

                        if (empty($opt['hideTitle'])) {
                            $endtab = true;
                            $endgroup = true;
                            $mapper->with($with, $opt);
                        }
                        if (isset($withcontent['_options'])) {
                            unset($withcontent['_options']);
                        }

                        // final adds
                        if (self::arrayDepth($withcontent) > 0) {
                            foreach ($withcontent as $name => $options) {
                                $fieldDescriptionOptions = [];
                                if (isset($options['_options'])) {
                                    $fieldDescriptionOptions = $options['_options'];
                                    unset($options['_options']);
                                }
                                $this->addField($mapper, $name, $options, $fieldDescriptionOptions);
                                $endgroup = $endtab = true;
                            }
                        }

                        if ($finalOrder != null) {
                            $mapper->reorder($finalOrder);
                        }

                        if ($endgroup) {
                            $mapper->end();
                        }
                    }
                }

                // order groups / withs (using tabs, because they are prioritary at the end)
                if (isset($groupsOrder)) {
                    // preparing
                    $otabs = $mapper->getAdmin()->{$fcts['tabs']['getter']}();
                    $groups = $mapper->getAdmin()->{$fcts['groups']['getter']}();

                    // pre-ordering
                    $newgroups = [];
                    $buf = empty($otabs[$tab]['auto_created']) ? "$tab." : '';
                    foreach ($groupsOrder as $groupname) {
                        if (isset($otabs[$tab]) && in_array("$buf$groupname", $otabs[$tab]['groups'])) {
                            $newgroups[] = "$buf$groupname";
                        }
                    }

                    // ordering tabs
                    foreach (empty($otabs[$tab]['groups']) ? [] : $otabs[$tab]['groups'] as $groupname) {
                        if (!in_array($groupname, $newgroups)) {
                            $newgroups[] = $groupname;
                        }
                    }
                    $otabs[$tab]['groups'] = $newgroups;

                    // "persisting"
                    $mapper->getAdmin()->{$fcts['tabs']['setter']}($otabs);
                }

                if ($endtab) {
                    $mapper->end();
                }
            }
        }

        // ordering tabs
        if (isset($tabsOptions['tabsOrder']) && $tabs = $this->{$fcts['tabs']['getter']}()) {
            $newtabs = [];
            foreach ($tabsOptions['tabsOrder'] as $tabname) {
                if (isset($tabs[$tabname])) {
                    $newtabs[$tabname] = $tabs[$tabname];
                }
            }
            foreach ($tabs as $tabname => $tab) {
                if (!isset($newtabs[$tabname])) {
                    $newtabs[$tabname] = $tab;
                }
            }
            $this->{$fcts['tabs']['setter']}($newtabs);
        }

        // ordering the ShowMapper
        if ($mapper instanceof ShowMapper) {
            foreach ($group as $tabName => $tabContent) {
                $tabOptions = null;
                if (isset($tabContent['_options'])) {
                    $tabOptions = $tabContent['_options'];
                    unset($tabContent['_options']);
                }

                if (isset($tabOptions['groupsOrder'])) {
                    $tabs = $this->{$fcts['tabs']['getter']}();
                    $groups = $this->{$fcts['groups']['getter']}();

                    $groupOrder = $tabOptions['groupsOrder'];

                    $properOrderedArray = array_merge(array_flip($groupOrder), $groups);

                    $this->{$fcts['groups']['setter']}($properOrderedArray);
                    $this->{$fcts['tabs']['setter']}($tabs);
                }
            }
        }

        return $mapper;
    }