1

We are using calcinai XeroPHP framework in our web service. We have 3 different Branding Themes for our contacts and I know all this branding themes ID's.

To assign BrandingTheme to existing contact I see special method in Contact class:

public function setBrandingTheme(BrandingTheme $value)
{
  $this->propertyUpdated('BrandingTheme', $value);
  $this->_data['BrandingTheme'] = $value;

  return $this;
}

As I see I need to pass BrandingTheme object to this method, but I don't see any way how to get or create this object? For example I need to set "Direct Debit" branding theme for contact, and I know that this branding theme have id "7ab6b4da-d5ed-4fdc-b9da-f359aafb63cf" in Xero.

What PHP code I need to use to set this BrandingTheme to contact? How I can get BrandingTheme object to pass to method?

Dmitry
  • 499
  • 1
  • 3
  • 19
  • I know I'm late but what does `getBrandingTheme()` return from the `Contact`? – hppycoder Apr 06 '21 at 17:08
  • Should return BrandingTheme object. But I need to set Branding theme to Contacts that don't have it. – Dmitry Apr 06 '21 at 21:08
  • Right, but if you see what's currently set then it might give some context as to how to mimic the BrandingTheme object with the ID `7ab6b4da-d5ed-4fdc-b9da-f359aafb63cf` you are requesting – hppycoder Apr 07 '21 at 11:53

1 Answers1

0

Looking through the documentation you have a method on your xero-php class to load something from a GUID, with that you should be able to get the correct theme to then attach to your contact.

$brandingTheme = $xero->loadByGUID(BrandingTheme::class, 'Your branding theme ID');
$contact->setBrandingTheme($brandingTheme);

Source: Interacting with the API

Kim Hallberg
  • 1,165
  • 1
  • 9
  • 18