Creating Express Objects programmatically

Permalink
I'm creating Express-Entities from my package controller:
$ag = Express::buildObject('exposee', 'exposees', 'Exposees', $pkg);
        $ag->addAttribute('text', '[1] => aID_ObjektNr', 'ag_nr');
        $ag->addAttribute('topics', 'Inventar', 'topics_inventar');

For simple text-attributes that works.
For the more complex topics-attribute-type I don't know how to add parameters to select the correct Topictree and Entry-node (see attached image).

The attribute field will be created on installation - but is not assigned to a topic-category.

Michael

1 Attachment

maschenborn
 
shahroq replied on at Permalink Best Answer Reply
shahroq
Hi,
//topics
$settings = new \Concrete\Core\Entity\Attribute\Key\Settings\TopicsSettings();
$settings->setTopicTreeID($topicTreeID);
$settings->setParentNodeID($topicParentNodeID);
$settings->setAllowMultipleValues(TRUE);
$eObj->addAttribute('topics', 'District', 'marina_district', $settings);

You can also find the related code for each attribute type in this cheat sheet:
https://github.com/shahroq/whale_c5_cheat_sheet#create-the-entity...
maschenborn replied on at Permalink Reply
maschenborn
fantastic. thank you.