basic.arrays.simple.txt 539 B

123456789101112131415161718192021222324252627282930313233
  1. Title: Simple Arrays
  2. Author: Dariusz Górecki <darek.krk@gmail.com>
  3. ---
  4. **Just define a property in yours model, and store an array in it! YES This is that simple**
  5. Example:
  6. ~~~
  7. [php]
  8. class User extends EMongoDocument
  9. {
  10. // ...
  11. public $myArray;
  12. // ...
  13. }
  14. $myArray = array('our', 'simple', 'example', 'array');
  15. $user = new User();
  16. $user->myArray = $myArray;
  17. $user->save();
  18. // that's it!
  19. // in any time after when you get yours model form DB
  20. $user = User::model()->find();
  21. echo $user->myArray[1];
  22. // will return 'simple'
  23. ~~~