Model Relationships: typo in example code

Offen
#230 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
1/5
Geschätzter Aufwand
Unter einer Stunde
Anfängerfreundlichkeit
45/100
Issue-Typ
Dokumentation
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
php
Bereich
documentation

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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).

Vorherrschende Sprache
CSS
Sterne
22
Forks
79
Ø Merge
2 T. 1 Std.
Gemergte PRs (30 T.)
6

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus ExpressionEngine/ExpressionEngine-User-Guide

Alle Issues in ExpressionEngine/ExpressionEngine-User-Guide

Ähnliche Issues

Weitere Issues zu Documentation

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.