public function enhanceStopPoints($stopPoints, $timetable)
    {
        $externalStopPointIds = array();
        $stopPointsIndexed = array();
        // extract externalStopPointIds to prepare SQL WHERE IN
        foreach ($stopPoints as $stopPoint_data) {
            $externalStopPointIds[] = $stopPoint_data->stop_point->id;
            // and index by navitia Id to make it easy to find an item inside
            $stopPointsIndexed[$stopPoint_data->stop_point->id] = $stopPoint_data;
        }
        $query = $this->om
            ->createQueryBuilder()
            ->addSelect('stopPoint')
            ->where("stopPoint.externalId IN(:externalStopPointIds)")
            ->from('CanalTPMttBundle:StopPoint', 'stopPoint')
            ->setParameter('externalStopPointIds', array_values($externalStopPointIds))
            ->andWhere("stopPoint.timetable = :timetableId")
            ->setParameter('timetableId', $timetable->getId())
            ->getQuery();
        $db_stop_points = $query->getResult();
        // add pdf generation date and Hash to stop points
        foreach ($db_stop_points as $db_stop_point) {
            if (isset($stopPointsIndexed[$db_stop_point->getExternalId()])) {
                $stopPointsIndexed[$db_stop_point->getExternalId()]->stop_point->pdfGenerationDate = $db_stop_point->getPdfGenerationDate();
                $stopPointsIndexed[$db_stop_point->getExternalId()]->stop_point->pdfHash = $db_stop_point->getPdfHash();
            }
        }

        return $stopPointsIndexed;
    }
public function enhanceStopPoints($stopPoints, $timetable)
    {
        $externalStopPointIds = array();
        $stopPointsIndexed = array();
        // extract externalStopPointIds to prepare SQL WHERE IN
        foreach ($stopPoints as $stopPoint_data) {
            $externalStopPointIds[] = $stopPoint_data->stop_point->id;
            // and index by navitia Id to make it easy to find an item inside
            $stopPointsIndexed[$stopPoint_data->stop_point->id] = $stopPoint_data;
        }
        $query = $this->om
            ->createQueryBuilder()
            ->addSelect('stopPoint')
            ->where("stopPoint.externalId IN(:externalStopPointIds)")
            ->from('CanalTPMttBundle:StopPoint', 'stopPoint')
            ->setParameter('externalStopPointIds', array_values($externalStopPointIds))
            ->andWhere("stopPoint.timetable = :timetableId")
            ->setParameter('timetableId', $timetable->getId())
            ->getQuery();
        $db_stop_points = $query->getResult();
        // add pdf generation date and Hash to stop points
        foreach ($db_stop_points as $db_stop_point) {
            if (isset($stopPointsIndexed[$db_stop_point->getExternalId()])) {
                $stopPointsIndexed[$db_stop_point->getExternalId()]->stop_point->pdfGenerationDate = $db_stop_point->getPdfGenerationDate();
                $stopPointsIndexed[$db_stop_point->getExternalId()]->stop_point->pdfHash = $db_stop_point->getPdfHash();
            }
        }

        return $stopPointsIndexed;
    }
public function enhanceStopPoints ( $ stopPoints , $ timetable ) { $ externalStopPointIds = array ( ) ; $ stopPointsIndexed = array ( ) ; // extract externalStopPointIds to prepare SQL WHERE IN foreach ( $ stopPoints as $ stopPoint_data ) { $ externalStopPointIds [ ] = $ stopPoint_data -> stop_point -> id ; // and index by navitia Id to make it easy to find an item inside $ stopPointsIndexed [ $ stopPoint_data -> stop_point -> id ] = $ stopPoint_data ; } $ query = $ this -> om -> createQueryBuilder ( ) -> addSelect ( 'stopPoint' ) -> where ( "stopPoint.externalId IN(:externalStopPointIds)" ) -> from ( 'CanalTPMttBundle:StopPoint' , 'stopPoint' ) -> setParameter ( 'externalStopPointIds' , array_values ( $ externalStopPointIds ) ) -> andWhere ( "stopPoint.timetable = :timetableId" ) -> setParameter ( 'timetableId' , $ timetable -> getId ( ) ) -> getQuery ( ) ; $ db_stop_points = $ query -> getResult ( ) ; // add pdf generation date and Hash to stop points foreach ( $ db_stop_points as $ db_stop_point ) { if ( isset ( $ stopPointsIndexed [ $ db_stop_point -> getExternalId ( ) ] ) ) { $ stopPointsIndexed [ $ db_stop_point -> getExternalId ( ) ] -> stop_point -> pdfGenerationDate = $ db_stop_point -> getPdfGenerationDate ( ) ; $ stopPointsIndexed [ $ db_stop_point -> getExternalId ( ) ] -> stop_point -> pdfHash = $ db_stop_point -> getPdfHash ( ) ; } } return $ stopPointsIndexed ; }
Return StopPoints list with Data from navitia

@param array $stopPointNavitiaIds Array of Stoppoints NavitiaId

@return array
Return StopPoints list with Data from navitia