Model Relationships: typo in example code

Ouverte
#230 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
1/5
Temps estimé
Moins d'une heure
Accessibilité débutants
45/100
Type d'issue
Documentation
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
php
Domaine
documentation

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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

Langage dominant
CSS
Étoiles
22
Forks
79
Merge moyen
2 j 1 h
PR mergées (30 j)
6

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de ExpressionEngine/ExpressionEngine-User-Guide

Toutes les issues de ExpressionEngine/ExpressionEngine-User-Guide

Issues similaires

Plus d'issues Documentation

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.