Skip to content

Instantly share code, notes, and snippets.

@jpingo
Last active December 13, 2015 16:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpingo/0edf2fc0a89274617e42 to your computer and use it in GitHub Desktop.
Save jpingo/0edf2fc0a89274617e42 to your computer and use it in GitHub Desktop.
Public API Relation Tests
<?php
public function _testTC1231UpdateAnObjectRelationClass__stage3()
{
$classUpdate = $this->api->getContentTypeToUpdate( 'a_relation_class' );
// Add new Field definiton.
$relAttr = $this->api->newFieldDefinition( 'obj_rel2', 'Object Relation 2', 'ezobjectrelation', 'This is a Object Relation test 2' );
$relAttr->isRequired = true;
$relAttr->isSearchable = false;
$relAttr->position = 3;
$relAttr->fieldSettings = array(
'selectionMethod' => 1,
'selectionRoot' => '999'
);
$classUpdate->addField( $relAttr );
$this->api->saveContentTypeUpdate( $classUpdate );
}
public function _testTC1487UpdateAnObjectRelationObject__stage2()
{
//Update the Oject Retation Object
$contentInfo = $this->api->getContentInfoByPath('/Object-Relation-Test');
$folder = $this->api ->getContentInfoByPath('/News');
$content = $this->api->getContentToUpdate( $contentInfo );
$content->setField( 'name', 'Object Relation Test Updated' );
//Set obj_rel to a available location
$content->setField( 'obj_rel', '999' );
$this->api->saveContentUpdate( $content );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment