コード例 #1
0
ファイル: Item.php プロジェクト: fangface/yii2-concord
 public function modelRelationMap()
 {
     return ['product' => array('type' => 'hasOne', 'class' => Product::className(), 'link' => array('productCode' => 'productCode'), 'allToArray' => true), 'order' => array('type' => 'belongsTo', 'class' => Order::className(), 'link' => array('id' => 'orderId')), 'customer' => array('type' => 'belongsTo', 'class' => Customer::className(), 'link' => array('id' => 'customerId'))];
 }
コード例 #2
0
ファイル: Customer.php プロジェクト: fangface/yii2-concord
 public function modelRelationMap()
 {
     return ['customerAttributes' => array('type' => 'hasEav', 'class' => CustomerAttributes::className(), 'link' => array('objectId' => 'id'), 'onSaveAll' => ActiveRecord::SAVE_CASCADE, 'onDeleteFull' => ActiveRecord::DELETE_CASCADE, 'autoLinkType' => ActiveRecord::LINK_FROM_PARENT_MAINT, 'allToArray' => true, 'activeAttributesInParent' => true), 'address' => array('type' => 'hasOne', 'class' => Address::className(), 'link' => array('id' => 'addressId'), 'onSaveAll' => ActiveRecord::SAVE_CASCADE, 'onDeleteFull' => ActiveRecord::DELETE_CASCADE, 'autoLinkType' => ActiveRecord::LINK_BI_DIRECT_MAINT_FROM_PARENT, 'autoLink' => array('fromParent' => array('customerId' => 'id'), 'fromChild' => array('id' => 'addressId')), 'allToArray' => true), 'phone' => array('type' => 'hasOne', 'class' => Phone::className(), 'link' => array('id' => 'phoneId'), 'onSaveAll' => ActiveRecord::SAVE_CASCADE, 'onDeleteFull' => ActiveRecord::DELETE_CASCADE, 'autoLinkType' => ActiveRecord::LINK_BI_DIRECT_MAINT_FROM_PARENT, 'autoLink' => array('fromParent' => array('customerId' => 'id'), 'fromChild' => array('id' => 'phoneId')), 'allToArray' => true), 'orders' => array('type' => 'hasMany', 'class' => Order::className(), 'link' => array('customerId' => 'id'), 'onSaveAll' => ActiveRecord::SAVE_CASCADE, 'onDeleteFull' => ActiveRecord::DELETE_CASCADE, 'autoLinkType' => ActiveRecord::LINK_FROM_PARENT_MAINT, 'allToArray' => true)];
 }