2

非常感谢 @Andreas 在 Podio 上回答我的问题:为关系应用程序字段分配参考时出现问题,它帮助我找到了所有 Podio 应用程序字段的特殊设置。

无论如何,我仍然无法将引用的应用程序分配给关系应用程序字段。

我尝试通过以下方式创建包含所有字段的应用程序:

$attributes = array(
            "space_id" => $ws->space_id,
            "config" => array(
                "icon" => DEFAULT_APP_ICON,
                "item_name" => "Test App",
                "name" => "TestApp"
            ),
            "fields" => array(
              array (
                "type" => "app",
                "external_id" => "test-reference-field",
                "config" => array (
                  "label" => "Test field",
                  "settings" => array(
                    "referenced_apps" => array(array("app_id" => 10048654))
                  )
                )
              )
            )
          );
          $app = new PodioApp($attributes);

但它根本不会在给定的工作区中创建应用程序,因此我通过调用静态 create() 方法创建了应用程序:

$app = PodioApp::create($attributes);

实际上,应用程序是在正确的工作区中创建的,但引用的应用程序根本没有链接。那么,这会是 API 错误还是我在代码中跳过的任何其他内容?任何帮助,将不胜感激

谢谢

4

1 回答 1

3

文档是错误的,你应该使用referenceable_types你的设置键,值应该只是一个 app_ids 数组。

$attributes = array(
        "space_id" => $ws->space_id,
        "config" => array(
            "icon" => DEFAULT_APP_ICON,
            "item_name" => "Test App",
            "name" => "TestApp"
        ),
        "fields" => array(
          array (
            "type" => "app",
            "external_id" => "test-reference-field",
            "config" => array (
              "label" => "Test field",
              "settings" => array(
                "referenceable_types" => array(233461, 233464)
              )
            )
          )
        )
      );
$app = PodioApp::create($attributes);
于 2014-11-10T19:02:54.933 回答