CustomerOrder.php 756 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace yiiunit\extensions\mongodb\data\ar;
  3. /**
  4. * @property \MongoDB\BSON\ObjectID|string $_id
  5. * @property int $number
  6. * @property \MongoDB\BSON\ObjectID $customer_id
  7. * @property array $item_ids
  8. */
  9. class CustomerOrder extends ActiveRecord
  10. {
  11. public static function collectionName()
  12. {
  13. return 'customer_order';
  14. }
  15. public function attributes()
  16. {
  17. return [
  18. '_id',
  19. 'number',
  20. 'customer_id',
  21. 'item_ids',
  22. ];
  23. }
  24. public function getCustomer()
  25. {
  26. return $this->hasOne(Customer::className(), ['_id' => 'customer_id']);
  27. }
  28. public function getItems()
  29. {
  30. return $this->hasMany(Item::className(), ['_id' => 'item_ids']);
  31. }
  32. }