Podio : Troubles assigning reference for a Relationship app field

别来无恙 提交于 2019-12-11 05:21:28

问题


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()
                                                    )
                                          ));

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 :)

Thank you all


回答1:


The config options are at: https://developers.podio.com/doc/applications

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);

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



来源:https://stackoverflow.com/questions/26756952/podio-troubles-assigning-reference-for-a-relationship-app-field

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!