Returns Lines indexed by modes.

@param string  $coverageId
@param type    $networkId
@param boolean $commercial if true commercial_modes returned, else physical_modes

@return type
4855
public function findAllLinesByMode($coverageId, $networkId)
    {
        $count = 30;
        $result = $this->navitia_sam->getLines($coverageId, $networkId, 1, $count);
        // no line found for this network
        if (empty($result) || !isset($result->lines)) {
            throw new \Exception(
                $this->translator->trans(
                    'services.navitia.no_lines_for_network',
                    array('%network%' => $networkId),
                    'exceptions'
                )
            );
        }

        if ($result->pagination->total_result > $count) {
            $result = $this->navitia_sam->getLines(
                $coverageId,
                $networkId,
                1,
                $result->pagination->total_result
            );
        }

        $lines_by_modes = array();
        foreach ($result->lines as $line) {
            if (!isset($lines_by_modes[$line->commercial_mode->id])) {
                $lines_by_modes[$line->commercial_mode->id] = array();
            }
            $lines_by_modes[$line->commercial_mode->id][] = $line;
        }

        return $lines_by_modes;
    }
300779
public static synchronized NetworkBuffer getBuffer(String installationID)
	{
		for (final Iterator i = buffers.iterator(); i.hasNext();) {
			final NetworkBuffer db = (NetworkBuffer) i.next();
			if (db.inst.equals(installationID))
				return db;
		}
		return null;
	}
1234487
public function getPvByProductAndStock($productId, $stockId)
    {
        /* aliases and tables */
        $asStockItem = 'csi';
        $asPv = 'ppsi';
        $tblStockItem = [$asStockItem => $this->resource->getTableName(Cfg::ENTITY_MAGE_CATALOGINVENTORY_STOCK_ITEM)];
        $tblPv = [$asPv => $this->resource->getTableName(Entity::ENTITY_NAME)];
        /* SELECT FROM cataloginventory_stock_item */
        $query = $this->conn->select();
        $cols = [];
        $query->from($tblStockItem, $cols);
        /* LEFT JOIN prxgt_pv_stock_item */
        $on = $asPv . '.' . Entity::A_ITEM_REF . '=' . $asStockItem . '.' . Cfg::E_CATINV_STOCK_ITEM_A_ITEM_ID;
        $cols = [Entity::A_PV];
        $query->joinLeft($tblPv, $on, $cols);
        /* WHERE */
        $where = $asStockItem . '.' . Cfg::E_CATINV_STOCK_ITEM_A_PROD_ID . '=' . (int)$productId;
        $where .= ' AND ' . $asStockItem . '.' . Cfg::E_CATINV_STOCK_ITEM_A_STOCK_ID . '=' . (int)$stockId;
        $query->where($where);
        /* fetch data */
        $result = $this->conn->fetchOne($query);
        return $result;
    }
1149534
private function getBaseSelectGlobal($productIds, $storeId)
    {
        $select = $this->getConnection()->select()
            ->from(['cpi' => $this->getTable($this->getCategoryProductIndexTable($storeId))], [])
            ->joinLeft(
                ['p' => $this->getTable(ProductPositionResourceModel::TABLE_NAME)],
                'p.product_id = cpi.product_id AND p.category_id = cpi.category_id AND p.store_id = 0',
                []
            );

        $this->joinStorePosition($select, $storeId, 0);

        $select->where('cpi.store_id = ?', (int) $storeId)
            ->where('cpi.product_id IN(?)', $productIds)
            ->columns([
                'category_id'    => 'cpi.category_id',
                'product_id'     => 'cpi.product_id',
                'is_parent'      => 'cpi.is_parent',
                'is_virtual'     => new \Zend_Db_Expr('"false"'),
                'position'       => 'p.position',
                'is_blacklisted' => 'p.is_blacklisted',
            ]);

        return $select;
    }
728225
public function getRouteCalendars($externalCoverageId, $externalRouteId, \DateTime $startDate, \DateTime $endDate)
    {
        $query = array(
            'api' => 'coverage',
            'parameters' => array(
                'region' => $externalCoverageId,
                'action' => 'calendars',
                'path_filter' => 'routes/'.$externalRouteId,
                'parameters' => '?start_date='.$startDate->format($this->dateFormat).'&end_date='.$endDate->format($this->dateFormat),
            ),
        );

        return $this->navitia_component->call($query);
    }
1257342
public function selectTypeAction($siteId = null)
    {
        $contentTypes = $this->get('opifer.content.content_type_manager')->getRepository()->findAll();

        $layouts = $this->get('opifer.content.content_manager')->getRepository()->findBy(['layout' => true]);

        if (!$contentTypes) {
            return $this->redirectToRoute('opifer_content_content_create');
        }

        return $this->render($this->getParameter('opifer_content.content_select_type'), [
            'content_types' => $contentTypes,
            'site_id' => $siteId,
            'layouts' => $layouts
        ]);
    }
977651
protected function &getParentBundle(array &$lines, $parentId)
    {
        foreach ($lines as &$line) {
            if (!empty($line[Meta::BundleId]) && $line[Meta::BundleId] === $parentId) {
                return $line;
            } elseif (!empty($line[Meta::ChildrenLines])) {
                // Recursively search for the parent bundle.
                $parent = &$this->getParentBundle($line[Meta::ChildrenLines], $parentId);
                if ($parent !== null) {
                    return $parent;
                }
            }
        }
        // Not found.
        return null;
    }
468877
public function getStopPoint($coverageId, $stopPointId, $params)
    {
        $pathFilter = 'stop_points/'.$stopPointId;
        $parameters = http_build_query($params);

        $query = array(
            'api' => 'coverage',
            'parameters' => array(
                'region' => $coverageId,
                'path_filter' => $pathFilter,
                'parameters' => $parameters,
            ),
        );

        return $this->navitia_component->call($query);
    }
625097
public function getRouteListByPlatform($platformId, $fields = null)
    {
        $params = array(
            'platform_id' => (int)$platformId,
        );
        if ($fields) {
            $params['fields'] = (string)$fields;
        }
        return $this->getInternalList(
            'transport/route/list',
            'Route',
            $params
        );
    }
1364552
static public function getPrefixFromId($networkId)
    {
        foreach (self::$networkInfos as $name => $spec) {
            if ($networkId === $spec['id'])
                return $spec['hex'];
        }

        throw new NISInvalidNetworkId("Network Id '" . $networkId . "' is invalid.");
    }
843511
public function getFullTagDataByRemoteId($remoteId, array $translations = null, $useAlwaysAvailable = true)
    {
        try {
            return $this->innerGateway->getFullTagDataByRemoteId($remoteId, $translations, $useAlwaysAvailable);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
474567
public function getActivePageThemeForSite($pageId, $themeId, $siteId = null, $mode = AbstractQuery::HYDRATE_OBJECT)
    {
        /** @var $query \Doctrine\ORM\QueryBuilder */
        try {
            $qb     = $this->getEntityManager()->createQueryBuilder();
            $params = [
                ':pageId'      => $pageId,
                ':active'      => 1,
                ':siteThemeId' => $themeId,
            ];
            $query  = $qb->select('e, p, t')
                ->from($this->getEntity(), 'e')
                ->innerJoin('e.template', 't')
                ->innerJoin('t.theme', 'th')
                ->innerJoin('e.page', 'p')
                ->where('e.page = :pageId')
                ->setParameters($params);

            if (is_numeric($themeId)) {
                $query->andWhere('t.theme = :siteThemeId');
            } else {
                $query->andWhere('th.slug = :siteThemeId');
            }

            $query->andWhere('e.isActive = :active');

            if ($siteId) {
                //$this->disableSiteFilter();
                $query->andWhere($query->expr()->eq('e.site', $siteId));
            }

            $query->setMaxResults(1);
            $result = $query->getQuery()->getOneOrNullResult($mode);

            return $result;
        } catch (\Exception $exception) {
            $this->getLogger()->logException($exception);

            return null;
        }
    }
654444
public function getSearchableProducts($storeId, $productIds = null, $fromId = 0, $limit = 1000)
    {
        $select = $this->getConnection()->select()
            ->from(['e' => $this->getTable('catalog_product_entity')]);

        $this->addIsVisibleInStoreFilter($select, $storeId);

        if ($productIds !== null) {
            $select->where('e.entity_id IN (?)', $productIds);
        }

        $select->limit($limit);
        $select->where('e.entity_id > ?', $fromId);
        $select->order('e.entity_id');

        return $this->connection->fetchAll($select);
    }
624261
public function search($forumId, $threadId)
    {
        $dataProvider = new ActiveDataProvider([
            'query' => static::find()->where(['forum_id' => $forumId, 'thread_id' => $threadId]),
            'pagination' => [
                'defaultPageSize' => 10,
                'pageSizeLimit' => false,
                'forcePageParam' => false
            ],
        ]);
        $dataProvider->sort->defaultOrder = ['id' => SORT_ASC];
        return $dataProvider;
    }
404816
@Override
    public Span get(String tenantId, String id) {
        Span span = spansCache.get(id);
        log.debugf("Get span [id=%s] = %s", id, span);
        return span;
    }
1241588
public function getHostFromId( $lanInterfaceId, $hostId){
        $service = sprintf( self::API_LAN_BROWSER_HOST, $lanInterfaceId, $hostId);
        $rest = $this->getService( $service);
        $rest->GET();

        return $rest->getResult( models\LAN\LanHost::class);
    }
72197
public function getLine($coverageId, $networkId, $lineId, $depth = 0)
    {
        $query = array(
            'api' => 'coverage',
            'parameters' => array(
                'region' => $coverageId,
                'action' => 'lines',
                'path_filter' => 'networks/'.$networkId.'/lines/'.$lineId,
                'parameters' => '?depth='.$depth,
            ),
        );

        return $this->navitia_component->call($query);
    }