跑道:为关系应用程序字段分配引用时遇到问题 [英] Podio : Troubles assigning reference for a Relationship app field

查看:25
本文介绍了跑道:为关系应用程序字段分配引用时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以编程方式创建了一个带有关系应用字段的应用

I programmatically created an app with a relationship app field

$app = new PodioApp($attributes);

创建成功后,我想创建一个关系应用字段

After it had been successfully created, I wanted to create a relationship app field

$field_id = PodioAppField::create( array (
                                        "type => "app",
                                        "external_id" => "test",
                                        "config" => array (
                                                        "label" => "Test field",
                                                        "settings" => array()
                                                    )
                                          ));

确实,该字段是在 podio 中创建的.现在,我想为该关系字段分配参考应用程序,我的代码如下:

Indeed, the field is created in podio. Now, I want to assign the reference app for that relationship field and my code is as follow:

$settings = array( 
                "apps" => array (
                            array("app_id" => 10036463)
                          )
            );
PodioAppField::update($app->app_id, $field_id, array (
                                                        "label" => "Updated_test_field",
                                                        "settings" => $settings
                                                   ));

屏幕或日志文件上均未显示错误.但是,当我在我的工作区中检查我的应用模板时,未设置到关系字段的参考应用.

There is no error shown either on the screen or on log file. However when I check my app template on my workspace, the reference app to the relationship field is not set up.

所以,如果有人能说出我的设置有什么问题,那就太好了:)

So, if anybody could tell what's wrong with my settings, it would be nice :)

谢谢大家

推荐答案

配置选项位于:https://developers.podio.com/doc/applications

设置名称不是 apps 而是 referenced_apps,您可以一次性完成.当您可以使用一个 API 调用创建应用时,就没有理由使用 3 个 API 调用:

The settings name is not apps but referenced_apps and you can do this in one go. There's no reason to use 3 API calls when you can create your app with one:

$attributes = array(
  "fields" => array(
    array (
      "type => "app",
      "config" => array (
        "label" => "Test field",
        "settings" => array(
          "referenced_apps" => array("app_id" => 10036463)
        )
      )
    )
  )
);
$app = new PodioApp($attributes);

我在这里省略了所有其他应用程序属性.我还删除了 external_id,因为它会自动为您生成一个.

I've omitted all the other app attributes here. I've also removed external_id since one will be automatically generated for you.

这篇关于跑道:为关系应用程序字段分配引用时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆