Skip to content

Instantly share code, notes, and snippets.

@lianglee
Last active November 9, 2017 18:50
Show Gist options
  • Select an option

  • Save lianglee/c9f20f2da7a49e8da06b0227a0abc0d1 to your computer and use it in GitHub Desktop.

Select an option

Save lianglee/c9f20f2da7a49e8da06b0227a0abc0d1 to your computer and use it in GitHub Desktop.
Simple way of creating objects
<?php
$proposal = new OssnObject();
//important attributes
$porposal->type = 'user';
$porposal->subtype = 'proposal'; //where this can be your name , but in general its not a table
$porposal->owner_guid = (int) 'guid of user';
$proposal->title = 'sometitle for proposal';
$proposal->description = 'some description for proposal';
//extra supporting attributes that didn't covers buy normal object
//where these are your table extra columns (other than title, description) but in general they are not really a columns in ossn database.
$proposal->data->text_theme = 'some text';
$proposal->data->text_level = 'some text';
$proposal->data->text_organisation = 'some text';
$proposal->data->text_language = 'some text';
$proposal->data->text_language = 'some text';
$proposal->data->text_content = 'some text';
//don't include $proposal->data->time, as the time is already created default and can be accessable when object is created by $proposal->time_created;
if ($guid = $proposal->save()) {
$object = ossn_get_object($guid); //ossn_get_object(<guid>); where
echo ossn_dump($object);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment