Model Relationships: typo in example code

Abierto
#230 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
1/5
Tiempo estimado
Menos de una hora
Aptitud para principiantes
45/100
Tipo de issue
Documentación
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
php

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
CSS
Estrellas
22
Forks
79
Merge medio
2 d 1 h
PR fusionados (30 d)
6

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de ExpressionEngine/ExpressionEngine-User-Guide

Todos los issues de ExpressionEngine/ExpressionEngine-User-Guide

Issues similares

Más issues de Documentation

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.