Add/Override definitions described in a BBcodeDefinitionCollectionInterface

@param BBcodeDefinitionCollectionInterface $collection
179999
public function loadDefinitionsFromService(BBcodeDefinitionCollectionInterface $collection)
    {
        foreach ($collection->getDefinitions() as $definition) {
            $this->addCodeDefinition($definition);
        }
    }
364494
protected function wizardAddCollection()
    {
        $this->validatePrompt('title', $this->text('Title'), 'collection');
        $this->validateMenu('type', $this->text('Type'), 'collection', $this->collection->getTypes());
        $this->validatePrompt('store_id', $this->text('Store'), 'collection');
        $this->validatePrompt('description', $this->text('Description'), 'collection', '');
        $this->validatePrompt('status', $this->text('Status'), 'collection', 0);

        $this->validateComponent('collection');
        $this->addCollection();
    }
400790
protected function addCollectionItem()
    {
        if (!$this->isError()) {
            $id = $this->collection_item->add($this->getSubmitted());
            if (empty($id)) {
                $this->errorAndExit($this->text('Unexpected result'));
            }
            $this->line($id);
        }
    }
500720
public function setTranslations(Collection $collection)
    {
        $this->translations = new ArrayCollection();

        foreach ($collection as $translation) {
            $this->addTranslation($translation);
        }
    }
920680
public function deleteRegistrationsOnCollection(\collection $collection)
    {
        $qb = $this->repository->createQueryBuilder('d');
        $qb->delete('Phraseanet:Registration', 'd');
        $qb->where($qb->expr()->eq('d.baseId', ':base'));
        $qb->setParameter(':base', $collection->get_base_id());
        $qb->getQuery()->execute();
    }
148649
public function addCollection(Collection $collection)
    {
        $metadata = $collection->getDocumentMetadata();
        $this->collectionMapping[$metadata->getName()] = $collection;
    }
816386
public function addDefinition(ItemDefinitionInterface $definition)
    {
        if (!is_string($definition->getMimeType())) {
            throw UnregisterableDefinitionException::notAStringMimeType($definition);
        }

        if (!in_array($definition->getMimeType(), ItemType::getList())) {
            throw UnregisterableDefinitionException::unsupportedMimeType($definition);
        }

        if ($this->has($definition->getMimeType())) {
            throw UnregisterableDefinitionException::duplicateMimeType($definition);
        }

        $this->definitions[$definition->getMimeType()] = $definition;
    }
845420
protected function configureRoutes(RouteCollection $collection)
    {
        parent::configureRoutes($collection);
        $collection->add('duplicate', $this->getRouterIdParameter() . '/duplicate');
        $collection->add('generateEntityCode');

        /* Needed or not needed ...
         * in sonata-project/admin-bundle/Controller/CRUDController.php
         * the batchAction method
         * throw exception if the http method is not POST
        */
        if ($collection->get('batch')) {
            $collection->get('batch')->setMethods(['POST']);
        }
    }
676438
public function setCollection($collection)
    {
        //Argument 1 must be a string
        Argument::i()->test(1, 'string');
        
        if ($collection != self::COLLECTION
        && !is_subclass_of($collection, self::COLLECTION)) {
            Exception::i()
                ->setMessage(Exception::NOT_SUB_COLLECTION)
                ->addVariable($collection)
                ->trigger();
        }
        
        $this->collection = $collection;
        return $this;
    }
1025917
public function merge(CollectionInterface $collection)
    {
        $this->items = array_merge(
            $this->getItems(),
            $collection->getItems()
        );

        return $this;
    }
586603
public function addCollection(self $collection)
    {
        $this->requirements = array_merge($this->requirements, $collection->all());
    }
78724
private function createItems(Collection $collection, array $collectionItemsData): void
    {
        foreach ($collectionItemsData as $collectionItemData) {
            $itemDefinition = $this->itemDefinitionRegistry->getItemDefinition($collectionItemData['value_type']);

            $item = $this->cmsItemLoader->loadByRemoteId(
                $collectionItemData['value'],
                $collectionItemData['value_type']
            );

            $itemCreateStruct = $this->collectionService->newItemCreateStruct(
                $itemDefinition,
                $item->getValue()
            );

            $this->setConfigStructs(
                $itemCreateStruct,
                $itemDefinition,
                $collectionItemData['configuration'] ?? []
            );

            $this->collectionService->addItem($collection, $itemCreateStruct, $collectionItemData['position']);
        }
    }
766492
private function addManyReferences(PersistentCollectionInterface $persistentCollection)
    {
        $mapping = $persistentCollection->getMapping();
        $ap = $this->dm->getUnitOfWork()->getAssociationPersister();

        foreach ($persistentCollection->getRawData() as $reference) {
            /** @var Identifier $identifier */
            $identifier = $ap->loadReference($mapping, $reference);
            $document   = $this->uow->tryGetByIdentifier($identifier);

            if ($document === false || ($document instanceof Proxy && !$document->__isInitialized())) {
                $className = $identifier->class->getName();
                $key       = serialize($identifier);

                $this->groupedIds[$className][$key] = $identifier;
            }
        }
    }
1052666
function giveCollection(MongoDB\Collection $collection)
    {
        if ($this->collection)
            throw new exImmutable;


        $this->collection = $collection;
        return $this;
    }
793182
public function loadCollection(PersistentCollectionInterface $collection)
    {
        $mapping = $collection->getMapping();
        switch ($mapping->association) {
            case PropertyMetadata::ASSOCIATION_TYPE_EMBED_MANY:
                $this->loadEmbedManyCollection($collection);
                break;

            case PropertyMetadata::ASSOCIATION_TYPE_REFERENCE_MANY:
                if ($mapping->repositoryMethod !== null) {
                    $this->loadReferenceManyWithRepositoryMethod($collection);
                } else {
                    if ($mapping->isOwningSide) {
                        $this->loadReferenceManyCollectionOwningSide($collection);
                    } else {
                        $this->loadReferenceManyCollectionInverseSide($collection);
                    }
                }
                break;
        }
    }
826898
private function processCollections(Block $block, array $collectionsData): void
    {
        foreach ($block->getCollections() as $identifier => $collection) {
            $collectionData = $collectionsData[$identifier];

            $collectionQuery = $collection->getQuery();

            if ($collectionQuery instanceof Query && is_array($collectionData['query'])) {
                $this->updateQueryTranslations(
                    $collectionQuery,
                    $collectionData['query']['parameters']
                );
            }

            $this->createItems($collection, $collectionData['items']);
        }
    }
30757
private function addSchema($collectionName, $schemaName, $schema)
    {
        if (!\is_string($schema) && !$schema instanceof SchemaDefinitionInterface) {
            throw new InvalidSchemaDefinitionException();
        }

        $this->schemaCollections[$collectionName][$schemaName] = $schema;
    }