Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. <?php
  2.  
  3. // Define our Model Schema
  4. $obj_book_schema = (new GDS\Schema('Book'))
  5. ->addString('title')
  6. ->addString('author')
  7. ->addString('isbn', TRUE)
  8. ->addDatetime('published', FALSE)
  9. ->addString('text', FALSE);
  10.  
  11. // Store requires a Gateway and Schema
  12. $obj_book_store = new GDS\Store($obj_book_schema);
  13.  
  14. // So now create a simple Model object
  15. $obj_book = new GDS\Entity();
  16. $obj_book->title = 'Romeo and Juliet 1';
  17. $obj_book->author = 'WilliamShakespeare';
  18. $obj_book->isbn = '1840224339';
  19. $obj_book->published = date('Y-m-d H:i:s');
  20. $obj_book->text = str_repeat('x', 4000);
  21.  
  22. // Insert
  23. $obj_book_store->upsert($obj_book);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement