1

基本上,我希望能够重用模型定义来针对 Doctrine 模型和 JSON-Schema。

我不在乎这是否意味着用第三种模型语言定义它并能够将其转换为 yml 和 json-schema 或者它是否来自 json-schema -> yml,只要我有 1 个地方来更新两者其中。

4

1 回答 1

4

Just off the top of my head, you could try parsing the YAML files into PHP arrays and then parsing the arrays into JSON with json_encode() or go the other way and json_decode() the JSON files and then parse the result into YAML format. The included sfYaml classes should be all you need for the YAML parsing/encoding and json_encode/json_decode are included in PHP 5.2 and up.

于 2010-07-06T05:46:52.413 回答