Last active
November 9, 2017 18:50
-
-
Save lianglee/c9f20f2da7a49e8da06b0227a0abc0d1 to your computer and use it in GitHub Desktop.
Simple way of creating objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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