Advertisement
robingchan

CakePHP - Deep relationship trawling.

Feb 25th, 2012
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.46 KB | None | 0 0
  1. array(
  2.  
  3. // Current users profile
  4.     'User' => array(
  5.         'id' => '1',
  6.         'email' => 'test@test.com',
  7.         'password' => '*****',
  8.         'firstname' => 'Robin',
  9.         'lastname' => 'Chan',
  10.         'name' => 'Robin Chan',
  11.         'created' => '2012-01-31 08:28:45',
  12.         'modified' => '2012-01-31 23:56:08'
  13.     ),
  14.  
  15. // Items current user is selling
  16.     'Item' => array(
  17.         (int) 0 => array(
  18.             'id' => '4',
  19.             'user_id' => '1',
  20.             'name' => 'Cats!',
  21.             'description' => 'cat',
  22.             'price' => '15.00',
  23.             'created' => '2012-02-01 20:43:25',
  24.             'modified' => '2012-02-01 20:43:25'
  25.         ),
  26.         (int) 1 => array(
  27.             'id' => '5',
  28.             'user_id' => '1',
  29.             'name' => 'Testingggg',
  30.             'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
  31.             'price' => '56.00',
  32.             'created' => '2012-02-23 16:31:34',
  33.             'modified' => '2012-02-23 16:31:34'
  34.         )
  35. // No offers/watchers here? Only if recursive is 2.
  36.  
  37. // Here recursive is 2 but it still doesnt get the users profile. Only displays the user_id!
  38.             'Offer' => array(),
  39.             'Watcher' => array(
  40.                 (int) 0 => array(
  41.                     'id' => '9',
  42.                     'item_id' => '5',
  43.                     'user_id' => '6',
  44.                     'created' => '2012-02-02 13:50:27',
  45.                     'modified' => '2012-02-02 13:50:27'
  46.                 )
  47.             )
  48.     ),
  49.  
  50. // Current users offers & watchers.
  51.     'Offer' => array(),
  52.     'Watcher' => array(
  53.         (int) 0 => array(
  54.             'id' => '11',
  55.             'item_id' => '3',
  56.             'user_id' => '1',
  57.             'created' => '2012-02-24 14:45:23',
  58.             'modified' => '2012-02-24 14:45:23'
  59.         )
  60.     )
  61. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement