@param $id
@param $sections

@return mixed
426968
public function updateTemplateSections($id, $sections)
    {
        /** @var $entity \PageBuilder\Entity\Template */
        if ($entity = $this->findObject($id)) {

            /** @var $ts \PageBuilder\Entity\Join\TemplateSection */
            foreach ($entity->getTemplateSections() as $ts) {
                $ts->setIsActive(0);
            }
            if ($ts = $entity->getTemplateSections()) {
                $entity->getTemplateSections()->clear();
            } else {
                $entity->setTemplateSections(new ArrayCollection());
            }
        }

        foreach ($sections as $key => $v) {
            $order = $key;
            if ($entry = $this->getEntityManager()->getRepository('PageBuilder\Entity\Join\TemplateSection')
                ->findOneBy(['templateId' => $id, 'sectionId' => $v])
            ) {
                $entry->setSortOrder($order);
                $entry->setIsActive(1);
            } elseif ($section = $this->getEntityManager()->getRepository('PageBuilder\Entity\Section')->find($v)
            ) {
                $entry = new TemplateSection();
                $entry->setSectionId($section);
                $entry->setTemplateId($entity);
                $entry->setSortOrder($order);
                $entry->setIsActive(1);
            }
            $entity->getTemplateSections()->add($entry);
        }

        return $this->save($entity);
    }
519521
function (id) {
                var res = this.idMap ? this.idMap[id] : null;
                if (res && res._type == TYPE_SECTION) {
                    return res;
                }
                return null;
            }
1032688
function sectionIDbyName( $params )
    {
        $sectionID = false;
        $sectionName = $params['section_name'];

        $sectionList = eZSection::fetchFilteredList( array( 'name' => $sectionName ), false, false, true );

        if( is_array( $sectionList ) && count( $sectionList ) > 0 )
        {
            $section = $sectionList[0];
            if( is_object( $section ) )
            {
                $sectionID = $section->attribute( 'id' );
            }
        }

        return $sectionID;
    }
204531
public function exportById($id): array
    {
        $entryType = Craft::$app->sections->getEntryTypeById((int) $id);

        return $this->export($entryType);
    }
291746
public function loadSectionData($id)
    {
        try {
            return $this->innerGateway->loadSectionData($id);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
1290834
protected function doContains($id)
    {
        $found = false;
        $this->delegate->get($id, null, $found);
        return $found;
    }
750759
public function updateNodeSection( $nodeID, $sectionID )
    {
        $contentObject = eZContentObject::fetchByNodeID( $nodeID );
        eZContentOperationCollection::registerSearchObject( $contentObject->attribute( 'id' ) );
    }
148036
public function set_section_shuffle($id, $shuffle) {
        global $DB;
        $section = $DB->get_record('quiz_sections', array('id' => $id), '*', MUST_EXIST);
        $section->shufflequestions = $shuffle;
        $DB->update_record('quiz_sections', $section);
    }
784108
public function actionGetSectionUrls(string $section, array $criteria = [], $siteId = null): Response
    {
        return $this->asJson(RouteMap::$plugin->routes->getSectionUrls($section, $criteria, $siteId));
    }
925274
public function addSections(array $sections): PageInterface
    {
        $sections = array_merge(
            $this->repository()->getSections()->all(),
            $sections
        );

        array_walk($sections, function ($section) {
            // Set a default view to each section if none defined.
            /** @var SectionInterface $section */
            if (empty($section->getView())) {
                $section->setView('section');
            }
        });

        $this->repository()->setSections($sections);

        return $this;
    }
600499
public function segment($id)
    {
        if (in_array($id, array_keys($this->segments))) {
            return $this->segments[$id];
        } else {
            throw new OutOfRangeException("Invalid argument provided, no segment is present with id: $id!");
        }
    }
418769
protected function getSection($sections, $section, $inheritance = false) {
		if (isset($sections[$section])) {
			return $sections[$section];
		}
		
		if ($inheritance) {
			foreach (array_keys($sections) as $part) {
				$colon = strpos($part, ':');

				if ($colon === false) {
					continue;
				}

				$successor = trim(substr($part, 0, $colon));
				$parent    = trim(substr($part, $colon + 1));
				
				if (! isset($successor[0], $parent[0])) {
					throw new InvalidIniSection('Invalid definition of the section "' . $part . '"');
				}

				if ($successor !== $section) {
					continue;
				}

				return array_replace(
					$this->getSection($sections, $parent, true),
					$sections[$part]
				);
			}
		}
		
		throw new InvalidIniSection('Section "' . $section . '" wasn\'t found');
	}
1372133
public static function get_modules_from_sectionid($sectionid) {
        global $DB;

        // Get the course and sequence of the section
        $secrec = $DB->get_record('course_sections', array('id' => $sectionid), 'course, sequence');
        $courseid = $secrec->course;
        $sequence = $secrec->sequence;

        // Get the section->sequence contents (it roots the activities order)
        // Get all course modules belonging to requested section
        $modulesarr = array();
        $modules = $DB->get_records_sql("
            SELECT cm.id, m.name AS modname
              FROM {course_modules} cm
              JOIN {modules} m ON m.id = cm.module
             WHERE cm.course = ?
               AND cm.section = ?
               AND cm.deletioninprogress <> 1", array($courseid, $sectionid));
        foreach (explode(',', $sequence) as $moduleid) {
            if (isset($modules[$moduleid])) {
                $module = array('id' => $modules[$moduleid]->id, 'modname' => $modules[$moduleid]->modname);
                $modulesarr[] = (object)$module;
                unset($modules[$moduleid]);
            }
        }
        if (!empty($modules)) { // This shouldn't happen, but one borked sequence can lead to it. Add the rest
            foreach ($modules as $module) {
                $module = array('id' => $module->id, 'modname' => $module->modname);
                $modulesarr[] = (object)$module;
            }
        }
        return $modulesarr;
    }
762841
def get_section(id, opts = {})
      data, _status_code, _headers = get_section_with_http_info(id, opts)
      return data
    end
297776
public function delete($id)
    {
        $contentCount = $this->sectionGateway->countContentObjectsInSection($id);

        if ($contentCount > 0) {
            throw new RuntimeException(
                "Section with ID '{$id}' still has content assigned."
            );
        }
        $this->sectionGateway->deleteSection($id);
    }
538097
public function setSectionForSubtree($pathString, $sectionId)
    {
        $selectContentIdsQuery = $this->connection->createQueryBuilder();
        $selectContentIdsQuery
            ->select('t.contentobject_id')
            ->from('ezcontentobject_tree', 't')
            ->where(
                $selectContentIdsQuery->expr()->like(
                    't.path_string',
                    $selectContentIdsQuery->createPositionalParameter("{$pathString}%")
                )
            );

        $contentIds = array_map(
            'intval',
            $selectContentIdsQuery->execute()->fetchAll(PDO::FETCH_COLUMN)
        );

        if (empty($contentIds)) {
            return false;
        }

        $updateSectionQuery = $this->connection->createQueryBuilder();
        $updateSectionQuery
            ->update('ezcontentobject')
            ->set(
                'section_id',
                $updateSectionQuery->createPositionalParameter($sectionId, PDO::PARAM_INT)
            )
            ->where(
                $updateSectionQuery->expr()->in(
                    'id',
                    $contentIds
                )
            );
        $affectedRows = $updateSectionQuery->execute();

        return $affectedRows > 0;
    }
313770
protected function getString($id = false, array $array = [], $section, $modelClass = __CLASS__)
    {
        $string = $section . $modelClass;

        if ($id) {
            $string = $string . 'id' . $id;
        }

        if ($array) {
            foreach ($array as $key => $value) {
                $string = $string . $key;
            }
        }

        return $string;
    }