Retrieve BAG details

@param string $type
@param string $id
185082
public function details($type, $id)
    {
      // Concat url
      $url = self::API_URL . '/' . $type . '/' . $id;

      // Create a REST request
      $request = new \LibX\Net\Rest\Request($url, \LibX\Net\Rest\Request::REQUEST_METHOD_GET);

      // Create a REST response
      $response = new \LibX\Net\Rest\Response();

      // Make the call
      $data = $this->call($request, $response);

      //return $data->_embedded;
      return $data;
    }
808231
private static function getItems($ids, $type)
    {
        $resultRCS = self::$client->request(
            'POST',
            self::BASEURL.'services/entreprise/rest/recherche/'.
            'resumeEntreprise?typeRecherche='.$type,
            [
                'json'    => $ids,
                'headers' => ['Content-Type' => 'text/plain'],
            ]
        );

        return json_decode($resultRCS->getBody())->items;
    }
1071632
public function getFullDatasPage($id, $type = '')
	{
		$select = $this->tableGateway->getSql()->select();
		
		$select->columns(array('*'));
		
		$select->join('melis_cms_page_lang', 'melis_cms_page_lang.plang_page_id = melis_cms_page_tree.tree_page_id', 
						array('plang_lang_id'));
		$select->join('melis_cms_lang', 'melis_cms_lang.lang_cms_id = melis_cms_page_lang.plang_lang_id', 
						array('*'), $select::JOIN_LEFT);
		$select->join('melis_cms_page_style', 'melis_cms_page_tree.tree_page_id = melis_cms_page_style.pstyle_page_id', array(), $select::JOIN_LEFT);
		
		$select->join('melis_cms_style', ' melis_cms_style.style_id = melis_cms_page_style.pstyle_style_id', array('*'), $select::JOIN_LEFT);
		
		if ($type == 'published' || $type == '')
			$select->join('melis_cms_page_published', 'melis_cms_page_published.page_id = melis_cms_page_tree.tree_page_id', 
							array('*'), $select::JOIN_LEFT);
		
		if ($type == 'saved')
			$select->join('melis_cms_page_saved', 'melis_cms_page_saved.page_id = melis_cms_page_tree.tree_page_id', 
							array('*'), $select::JOIN_LEFT);
		
		if ($type == '')
		{
			$columns = $this->aliasColumnsFromTableDefinition('MelisEngine\MelisPageColumns', 's_');
			$select->join('melis_cms_page_saved', 'melis_cms_page_saved.page_id = melis_cms_page_tree.tree_page_id',
						$columns, $select::JOIN_LEFT);
		}
		
		$select->join('melis_cms_page_seo', 'melis_cms_page_seo.pseo_id = melis_cms_page_tree.tree_page_id',
		    array('*'), $select::JOIN_LEFT);
		
		$select->where('tree_page_id = ' . $id);
		
		$resultSet = $this->tableGateway->selectWith($select);
		
		return $resultSet;
	}
76613
private function setCover(Item $item, $id, $type)
    {
        $item->setCover(self::NAME.'/'.$id.'/1.jpg');

        return $this->uploadImage($this->getCoverUrl($id, $type), $item);
    }
485862
private static function DaftObjectIdPropertiesFromType(string $type, $id) : array
    {
        /**
        * @var array<int, string>
        */
        $idProps = array_values($type::DaftObjectIdProperties());

        if (is_scalar($id) && 1 === count($idProps)) {
            $id = [$id];
        }

        /**
        * @var array<string, mixed>
        */
        $idkv = [];

        if (is_array($id)) {
            foreach ($idProps as $i => $prop) {
                /**
                * @var scalar|array|object|null
                */
                $propVal = $id[$i] ?? null;

                $idkv[$prop] = $propVal;
            }
        }

        return $idkv;
    }
786362
public function getTypeElementById( $id, $types = null )
	{
		$fragment = parse_url( $id, PHP_URL_FRAGMENT );
		$fragment = $fragment ? $fragment : $id;

		$taxonomy = $this->getTaxonomyForXSD( $id );
		if ( ! $taxonomy )
		{
			$this->log()->warning( "Unable to locate taxonomy for id '$id'" );
			return false;
		}

		if ( is_null( $types ) ) $types = XBRL_Types::getInstance();
		return $types->getElement( $fragment, $taxonomy->getPrefix() );
	}
903565
public function resourceLinkMeta(string $type, string $id): array
    {
        foreach ($this->resourceMap as $resourceLink) {
            if (isset($resourceLink["meta"]) && $resourceLink["type"] === $type && $resourceLink["id"] === $id) {
                return $resourceLink["meta"];
            }
        }

        return [];
    }
108092
public function actionIndex($id, $type = 'notes')
    {
        $model = $this->findModel($id);
        if (!isset($this->collectionClassMaps[$type])) {
            throw new NotFoundHttpException(Yii::t('yii', 'The requested page does not exist.'));
        }
        $query = $model->getCollections()->andWhere(['model' => $this->collectionClassMaps[$type]])->orderBy(['created_at' => SORT_DESC]);
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);
        return $this->render('index', [
            'model' => $model,
            'type' => $type,
            'dataProvider' => $dataProvider
        ]);
    }
1036400
public function getEntityPath($type, $id)
    {
        // Allow other modules to interact
        $event = new EntityGetPathEvent($type, $id);
        $this->eventDispatcher->dispatch(EntityGetPathEvent::EVENT_GET_PATH, $event);
        if ($path = $event->getPath()) {
            return $path;
        }

        // In most cases, this will be used for nodes only, so just set the
        // node URL.
        // It will avoid nasty bugs, since the 'text' core module does sanitize
        // (and call check_markup()) during field load if there are any circular
        // links dependencies between two nodes, it triggers an finite loop.
        // This will also make the whole faster.
        // @todo If node does not exists, no error will be triggered.
        if ('node' === $type) {
            return 'node/' . $id;
        }

        $entity = $this->entityManager->getStorage($type)->load($id);
        if (!$entity) {
            throw new \InvalidArgumentException(sprintf("entity of type %s with identifier %s does not exist", $type, $id));
        }

        if (!$entity instanceof EntityInterface) {
            return $this->getDrupalEntityPath($type, $entity);
        } else {
            return $entity->url();
        }
    }
108164
public function getFrames($id, $type)
    {
        $dom = $this->browser->getDom('/'.$type.'/'.$type.'_photos.php?id='.$id);
        if (!$dom) {
            return [];
        }
        $images = (new \DOMXPath($dom))->query('//table//table//table//img');
        $frames = [];
        foreach ($images as $image) {
            $src = $this->getAttrAsArray($image)['src'];
            $entity = new Image();
            if ($type == self::ITEM_TYPE_ANIMATION) {
                $src = str_replace('optimize_b', 'optimize_d', $src);
                if (strpos($src, 'http://') === false) {
                    $src = $this->browser->getHost().'/'.$type.'/'.$src;
                }
                if (preg_match('/\-(?<image>\d+)\-optimize_d(?<ext>\.jpe?g|png|gif)/', $src, $mat)) {
                    $entity->setSource(self::NAME.'/'.$id.'/'.$mat['image'].$mat['ext']);
                    if ($this->uploadImage($src, $entity)) {
                        $frames[] = $entity;
                    }
                }
            } elseif (preg_match('/_(?<round>\d+)\/.+\/(?<id>\d+)-(?<image>\d+)-.+(?<ext>\.jpe?g|png|gif)/', $src, $mat)) {
                $src = $this->browser->getHost().'/'.$type.'/img/'.$mat['round'].'/'.$mat['id'].'/'.$mat['image'].$mat['ext'];
                $entity->setSource(self::NAME.'/'.$id.'/'.$mat['image'].$mat['ext']);
                if ($this->uploadImage($src, $entity)) {
                    $frames[] = $entity;
                }
            }
        }

        return $frames;
    }
158551
public function getUser($type, $id)
    {
        $response = $this->get('v1/users/'.$type.'/'.$id);

        if (is_null($response)) {
            return null;
        }

        return new NorthstarUser($response['data']);
    }
1242081
public function fileAction($id, $type)
    {
        $cm = new CronManager();
        $crons = $cm->get();
        $cron = $crons[$id];

        $data = array();
        $data['file'] =  ($type == 'log') ? $cron->getLogFile(): $cron->getErrorFile();
        $data['content'] = \file_get_contents($data['file']);

        $serializer = new Serializer(array(), array('json' => new JsonEncoder()));

        return new Response($serializer->serialize($data, 'json'));
    }
321378
public function getType($id)
    {
        if (null === $id) {
            // The caller might call us using a row from database that contains
            // a strict null, it is useless for us to do any query since null
            // typed messages are valid by the MessageInterface signature
            return null;
        }

        if (null === $this->types) {
            $this->loadCache();
        }

        if (!isset($this->types[$id])) {
            // Someone may have created it before we loaded the cache
            $this->loadCache();

            if (!isset($this->types[$id])) {
                // It seems that the type really does not exists, mark it as
                // being wrong in order to avoid to refresh the cache too often
                // and return a null type
                $this->types[$id] = false;
            }
        }

        if (false === $this->types[$id]) {
            return null;
        } else {
            return $this->types[$id];
        }
    }
80492
public function get(string $type, string $id): ResourceInterface
    {
        if (!$this->has($type, $id)) {
            throw new ResourceNotFoundException($type, $id);
        }

        return $this->collection[$this->buildArrayKey($type, $id)];
    }
690579
public function geo($type, $id)
    {
      // Concat url
      $url = self::API_URL . '/' . $type . '/' . $id;

      // Create a REST request
      $request = new \LibX\Net\Rest\Request($url, \LibX\Net\Rest\Request::REQUEST_METHOD_GET);

      // Create a REST response
      $response = new \LibX\Net\Rest\Response();

      // Make the call
      $data = $this->call($request, $response);

      // Init
      $coordinates = null;

      // Get geo data
      if(isset($data->_embedded->geometrie))
      {
        $geo = $data->_embedded->geometrie;

        if($geo->type === 'Point')
        {
          $longitude = $geo->coordinates[0];
          $latitude = $geo->coordinates[1];

          $coordinates = new Coordinates($latitude, $longitude);
        }
        elseif($geo->type === 'Polygon')
        {
          $points = new PointStack();

          foreach($geo->coordinates[0] as $coordinates)
          {
            $longitude = $coordinates[0];
            $latitude = $coordinates[1];

            $points->push(new Coordinates($latitude, $longitude));
          }

          $coordinates = new Polygon($points);
        }
      }

      return $coordinates;
    }
430979
protected function _delete($type, $id = null, array $parameters = []) {
        return $this->__delete($this->index(), $type, $id, $parameters);
    }
253236
public function problem($id, $type = 'id')
    {
        $problem = $this->load('p', array($type, $id));

        return Helper\formatProblem($problem);
    }