Add builder.

@param ManagerBuilder $builder

@throws \RuntimeException
357030
public function addBuilder(ManagerBuilder $builder)
    {
        $builderName = (string) $builder->getName();
        if ($builderName === '') {
            throw new \RuntimeException('Only named manager builders allowed');
        }

        if (array_key_exists($builderName, $this->builders)) {
            throw new \RuntimeException(sprintf('"%s" manager builder is already registered', $builderName));
        }

        $this->builders[$builderName] = $builder;
    }
1057947
protected function addWithDrafts(Builder $builder)
    {
        $builder->macro('withDrafts', function (Builder $builder) {
            $this->remove($builder, $builder->getModel());

            return $builder;
        });
    }
1373617
protected function addClose(Builder $builder): void
    {
        $builder->macro('close', function (Builder $builder) {
            return $builder->update(['closed_at' => Date::now()]);
        });
    }
110933
public function addFieldOptions($builder)
    {
        $builder->get('options')
            ->add('is_multiple', ChoiceType::class, [
                'choices' => [
                    'No' => false,
                    'Yes' => true,
                ]
            ])
        ;

        parent::addFieldOptions($builder);
    }
1199985
protected function addUndoArchive(Builder $builder): void
    {
        $builder->macro('undoArchive', function (Builder $builder) {
            $builder->withArchived();

            return $builder->update(['archived_at' => null]);
        });
    }
183767
protected function addWithNotAccepted(Builder $builder): void
    {
        $builder->macro('withNotAccepted', function (Builder $builder) {
            return $builder->withoutGlobalScope($this);
        });
    }
156109
public function addToManager(Manager $manager)
    {
        $parser = $this->createTypeParser();
        $type = $parser->getType();
        if ($this->isInternal($type->name)) {
            return;
        }
        $manager->addType($type, $parser->getName());
    }
193982
protected function addWithPending(Builder $builder)
    {
        $builder->macro('withPending', function (Builder $builder) {
            $this->remove($builder, $builder->getModel());

            return $builder->whereIN($this->getStatusColumn($builder), [Status::APPROVED, Status::PENDING]);
        });
    }
959194
public function buildForm(FormBuilderInterface $builder, array $options)
    {
        parent::buildForm($builder, $options);

        $this->addIban($builder)
            ->addBic($builder);
    }
93481
protected function initializeFromBuilder(Builder $builder)
    {
        $this->setModel($builder->getModel())
            ->setEagerLoads($builder->getEagerLoads());

        $builder->macro('getProtected', function (Builder $builder, string $property) {
            return $builder->{$property};
        });

        $this->scopes = $builder->getProtected('scopes');

        $this->localMacros = $builder->getProtected('localMacros');

        $this->onDelete = $builder->getProtected('onDelete');
    }
371985
public function build(Builder $builder): Builder
    {
        $this->options = $builder->getModel()->getOptionsFilter();
        $this->addFiltersToQuery($builder);
        $this->addSortsToQuery($builder);

        return $builder;
    }
831834
protected function addWithEnded(Builder $builder): void
    {
        $builder->macro('withEnded', function (Builder $builder) {
            return $builder->withoutGlobalScope($this);
        });
    }
1091304
protected function addUndoActivate(Builder $builder): void
    {
        $builder->macro('undoActivate', function (Builder $builder) {
            return $builder->update(['is_active' => 0]);
        });
    }
643930
protected function addBIC(FormBuilderInterface $builder)
    {
        $builder->add(
            self::FIELD_BIC,
            TextType::class,
            [
                'label' => false,
                'required' => true,
                'constraints' => [
                    $this->createManageMandateConstraint(),
                ],
            ]
        );

        return $this;
    }
193985
protected function addBankAccount(FormBuilderInterface $builder)
    {
        $builder->add(
            static::FIELD_BANK_ACCOUNT,
            TextType::class,
            [
                'label' => false,
                'required' => true,
                'constraints' => [
                ],
            ]
        );

        return $this;
    }
569456
protected function addKeep(Builder $builder): void
    {
        $builder->macro('keep', function (Builder $builder) {
            $builder->withNotKept();

            return $builder->update(['is_kept' => 1]);
        });
    }
152155
protected function addReject(Builder $builder)
    {
        $builder->macro('reject', function (Builder $builder, $id = null) {
            $builder->withAnyStatus();
            return $this->updateModerationStatus($builder, $id, Status::REJECTED);

        });
    }