omatech/editora-extractor

此包的最新版本(v1.1.4)没有可用的许可信息。

使用Facebook GraphQL以强大而神秘的方式从Editora提取信息

v1.1.4 2022-03-26 08:58 UTC

README

使用GraphQL或简化数组结构从omatech Editora提取信息的实用工具

入门

以下说明将帮助您在本地机器上获取项目的副本并启动开发测试。有关如何在生产系统中部署项目的说明,请参阅部署部分。

在composer中包含omatech/editora-extractor并开始使用

查看omatech/editora-laravel-connector包,以便轻松集成Laravel

先决条件

您需要一个有效的连接到editora数据库,使用Doctrine/DBAL

用法

实例

获取所需关系的实例信息。

例如,获取inst_id=1(首页)并获取名为"carrousel"、"news"和"people"的关系。

$params = [ 'id' => '1' , 'lang' => 'ca' , 'debug' => true , 'metadata' => true ];

$query='query FetchHomeQuery ($id:Int, $lang:String, $debug:Boolean) { instance(id: $id, lang: $lang, debug: $debug) { id nom_intern link publishing_begins status creation_date class_name class_tag class_id update_timestamp all_values_even_null (filter: "small") {atri_tag text_val}

relation1 (tag: "carrousel", limit:2, alias: "mycarrousel")
	{
	  id tag direction limit
		instances {
			id nom_intern link publishing_begins status creation_date class_name class_tag class_id update_timestamp
			all_values_even_null (filter: "fields:title|subtitle_t") {atri_tag text_val}
		}
	}
	
relation2 (tag: "news", limit: 5)
	{
	  id tag direction limit
		instances {
		  id nom_intern link
			all_values_even_null (filter: "small") {atri_tag, text_val}
		}
	}

relation3 (tag: "people", limit:10)
	{
	  id tag direction limit
		instances {
		  id nom_intern link publishing_begins status creation_date
			all_values_even_null {atri_tag text_val}
		}
	}

} }';

$extractor=new Extractor($conn); $res=$extractor->extract($query, $params, 'array', false); // $res now contains an array with the tree of the content

调用提取器

$res=$extractor->extract($query, $params, $format, $ferretizer);

$query: 是GraphQL查询 $params: 合法的参数数组(见params数组部分) $format: ('array' | 'json') 输出格式。默认为'array' $ferretizer: (true | false) 选择是否使用ferretizer后处理程序简化结果,通常为true。默认为true

参数数组

可用的参数包括

id: inst_id lang: 提取的语言,两个字母的语言代码或ALL ('ALL' | 'ca' | 'es' |...) class_id: 您想要从其提取实例的类别 tag: 您想要从其提取实例的类的标签 metadata: 如果您想要为每个对象提取额外的元数据,则为true,否则为false,默认为false。 preview: 如果您想要提取挂起的对象,则为true,否则为false,默认为false。 debug: 如果您想要在提取过程中获取调试信息,则为true,否则为false,默认为false。 $extractor->debug_messages 保留调试信息

安装

待定

贡献

待定

版本

待定

作者

Agusti Pons Christian Bohollo Javier Mogollon

许可

本项目受MIT许可协议许可