@param Section $section
@param array   $uuids

@return array $contributions
335530
public function compareContributions(Section $section, $uuids)
    {
        $contributions = $this->contributionRepository->findyBySectionAndUuids($section, $uuids);
        $titleDiff = new HtmlDiff($contributions[0]->getTitle(), $contributions[1]->getTitle(), false);
        $textDiff = new HtmlDiff($contributions[0]->getText(), $contributions[1]->getText(), true);
        $contribution = new Contribution();
        $contribution->setText($textDiff->outputDiff()->toString());
        $contribution->setTitle($titleDiff->outputDiff()->toString());
        $contribution->setContributor($contributions[1]->getContributor());
        $contribution->setCreationDate($contributions[1]->getCreationDate());
        $contribution->refreshUuid();
        $contributions[1] = $contribution;

        return $contributions;
    }
777359
public function excludeUUIDs(array $uuids): self
    {
        $this->filters['excluded_ids'] = Filter::create(
            '_id',
            array_map(function (ItemUUID $uuid) {
                return $uuid->composeUUID();
            }, $uuids),
            Filter::EXCLUDE,
            Filter::TYPE_FIELD
        );

        return $this;
    }
1167988
private function generateTreeByPath(array $contents, $uuid)
    {
        $childrenByPath = [];

        foreach ($contents as $content) {
            $path = PathHelper::getParentPath($content->getPath());
            if (!isset($childrenByPath[$path])) {
                $childrenByPath[$path] = [];
            }

            $order = $content['order'];
            while (isset($childrenByPath[$path][$order])) {
                ++$order;
            }

            $childrenByPath[$path][$order] = $content;
        }

        foreach ($contents as $content) {
            if (!isset($childrenByPath[$content->getPath()])) {
                if ($content->getId() === $uuid) {
                    $content->setChildren([]);
                }

                continue;
            }

            ksort($childrenByPath[$content->getPath()]);

            $content->setChildren(array_values($childrenByPath[$content->getPath()]));
        }

        if (!array_key_exists('/', $childrenByPath) || !is_array($childrenByPath['/'])) {
            return [];
        }

        ksort($childrenByPath['/']);

        return array_values($childrenByPath['/']);
    }
241625
public function updateObjectsSection( array $objectIDs, $sectionID )
    {
        foreach( $objectIDs as $id )
        {
            $object = eZContentObject::fetch( $id );
            // we may be inside a DB transaction running update queries for the
            // section id or the content object may come from the memory cache
            // make sure the section_id is the right one
            $object->setAttribute( 'section_id', $sectionID );
            eZContentOperationCollection::registerSearchObject( $id );
        }
    }
666484
public function section($section, $position = null)
    {
        if (is_string($section)) {
            $section = new FormSection($section);
        }

        return null !== $position ? $this->insert($section, $position) : $this->push($section);
    }
71113
private function updateSectionNodes($sectionUid, $leftNode, $rightNode, $level)
    {
        $this->createQueryBuilder('s')
                ->update()
                ->set('s._leftnode', $leftNode)
                ->set('s._rightnode', $rightNode)
                ->set('s._level', $level)
                ->where('s._uid = :uid')
                ->setParameter('uid', $sectionUid)
                ->getQuery()
                ->execute();

        return $this;
    }
870405
public function findAllButActiveForSection(Section $section)
    {
        $queryBuilder = $this->createQueryBuilder('contribution')
            ->orderBy('contribution.creationDate', 'DESC')
            ->andWhere('contribution.section = :section')
            ->andWhere('contribution.id != :activeId')
            ->setParameter('section', $section)
            ->setParameter('activeId', $section->getActiveContribution()->getId());

        return $queryBuilder->getQuery()->getResult();
    }
1123048
public function getSection($id, $section)
    {
        $incomingMessage = new IncomingMessage($this->imap, $id);
        return $incomingMessage->getSection($section);
    }
1255079
private function enrichHeaderWithFields(
        array &$headers,
        string $section,
        array $fields
    ) {
        foreach ($fields as $fieldName => $_) {
            if (!in_array($fieldName, $headers[$section])) {
                $headers[$section][] = $fieldName;
            }
        }
    }
342287
protected function cleanAccessLevels($uuid, $accessLevels)
    {
        foreach ($accessLevels as $key => $accessLevel) {
            if ($this->hasGroupLoop($accessLevel, $uuid)) {
                unset($accessLevels[$key]);
            }
        }
        
        return $accessLevels;
    }
197057
public function setUUid($uuid = null)
    {
        $notAllowedNames = [
            ListRepositoryInterface::CHUNK,
            ListRepositoryInterface::HEADERS,
            ListRepositoryInterface::INDEX,
            ListRepositoryInterface::SEPARATOR,
            ListRepositoryInterface::STATISTICS,
        ];

        foreach ($notAllowedNames as $notAllowedName) {
            if (strpos($uuid, $notAllowedName) !== false) {
                throw new ListElementNotAllowedUuidException('You can\'t assign "'.$uuid.'" as element uuid.');
            }
        }

        $this->uuid = str_replace(' ', '-', $uuid) ?: Uuid::uuid4()->toString();
    }
872184
public function findByUuid($uuid, $columns = ['*'])
    {
        if (is_array($uuid) || $uuid instanceof Arrayable) {
            return $this->findManyByUuid($uuid, $columns);
        }

        return $this->whereUuidKey($uuid)->first($columns);
    }
684501
public function add($field, SectionInterface $section = null): UserFieldContract
    {
        if ($field instanceof SectionInterface) {
            $section = $field;

            if ($section->hasItems()) {
                foreach ($section->getItems() as $item) {
                    /** @var FieldTypeInterface $item */
                    $item->setOptions([
                        'group' => $section->getId()
                    ]);

                    $this->add($item, $section);
                }
            }

            return $this;
        }

        // Setup field options
        $field->setTheme('themosis.users');
        $field->setPrefix($this->options['prefix']);

        $this->repository->addField($field, $this->getSection($field, $section));

        return $this;
    }
980531
public function addSection(Section $section)
    {
        $this->registry['sections'][] = $section;

        $this->currentSection = $section;

        return $this;
    }
245907
public function removeSection(\Coral\ContentBundle\Entity\Section $sections)
    {
        $this->sections->removeElement($sections);
    }
1090852
private function updatePageLevel($sectionUid, $level)
    {
        $page_repo = $this->getEntityManager()
                ->getRepository('BackBee\NestedNode\Page');

        $page_repo->createQueryBuilder('p')
                ->update()
                ->set('p._level', $level)
                ->where('p._uid = :uid')
                ->setParameter('uid', $sectionUid)
                ->getQuery()
                ->execute();

        $page_repo->createQueryBuilder('p')
                ->update()
                ->set('p._level', $level + 1)
                ->where('p._section = :uid')
                ->andWhere('p._uid <> :uid')
                ->setParameter('uid', $sectionUid)
                ->getQuery()
                ->execute();

        return $this;
    }
697307
public function fromAggregates(array $uuids)
    {
        $streams = [];

        foreach ($uuids as $uuid) {
            $streams = array_merge($streams, $this->fromAggregate($uuid));
        }

        return $streams;
    }