Model Relationships: typo in example code

未關閉
#230 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
1/5
預估耗時
1 小時以內
新手友好度
45/100
Issue 類型
文件
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
php
領域
documentation

研究方向

Read the model relationships section linked in the issue and compare its examples with the EE6 relationship definition described here. The issue reports that adding the ee: prefix to the model name fixes an unknown-model error, but asks for confirmation that this is a documentation bug. Done means verifying the behavior and correcting the examples if confirmed.

由索引模型根據 Issue 內容生成。

描述

Description of the problem
In the description of model relationships there are several examples of code used to define relationships between models. The examples all have the same basic core that looks something like this:

protected static $_relationships = array(
  'Author' => array(
    'model' => 'Member',
    'type' => 'BelongsTo'
  )
);

For EE6 at least this construct appears to be incorrect, as using this type of construct omits the ee: prefix and (at least in this authors test system) without this prefix EE will reject the relationship throwing an error of the form:

Unknown model "Member". Used in model "myAddon:Model" for a relationship called "Reln".

Adding the ee: prefix eliminates the error and leads to normal operation.

protected static $_relationships = array(
  'Author' => array(
    'model' => 'ee:Member',
    'type' => 'BelongsTo'
  )
);

However it may be that this is an issue unique to my system, so I would value observations about whether or not this is indeed a documentation bug.

If it is indeed a bug I'm happy to amend the documentation as required.

Additional context
The ee: prefix is used in relationship definitions within the EE code (e.g. in Addons\Forum\Model\Administrator.php).

主要語言
CSS
星號
22
分支
79
平均合併
2 天 1 小時
30 天內合併 PR
6

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

ExpressionEngine/ExpressionEngine-User-Guide 的其他 Issue

查看 ExpressionEngine/ExpressionEngine-User-Guide 的全部 Issue

相似的 Issue

更多 Documentation Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。