MembresTable" is not associated with "Grossistes"

Problem in Membres_or Grossistes Controller.php
Type Table is working but not Grossistes Table.











Check in you MembersTable if you have something like this

$this->belongsTo('Grossistes');

note that on normal inflector (english) this generate

$member->grossiste-> .....

Hello Sir Raúl Arellano,
thanks for this quick reply;
Here is that part of MembersTable


And first part of MembresController.php

Note that for table “types” (Type d.adhésion, it works.)
image.png

See in module “ajouter.ctp”, we can see all contain of that table, that is:



Non-Membre



Membre-Ami



Nembre-Animateur



Membre-à-Vie

So we can select one of the entries`

Thanks for your precious collaboration, hoping a follow-up.

(this Cakephp application is in french language.

Best regards

Benoit

P.S. I can give you a link to this app if necessary

I’m not fully understanding the problem.
Is an exception somewhere? where? What code would be the query?

or is that is not showing the select in “grossiste” field?

Hello Sir Raúl Arellano,
I will try to explain more:
Here as an attached documents, modules which are concerned;

src/controller

MembresController.php;
MembresTable.php

src/template/Membres
ajouter.ctp

image.png

(Attachment MembresController.php is missing)

(Attachment GrossistesTable.php is missing)

(Attachment TypesTable.php is missing)

(Attachment ajouter.ctp is missing)

Hello Sir Raúl Arellano,
Sorry for attached .php documents sent by error;

Here is my request:

I want to display in view (afficher.ctp), Grossistes table element, pointed by index grossiste_id in membres table.

in view document (afficher.ctp), see lines 78-81:

Grossiste <?= h($grossistes.etiquette) ?>


Thank you for your precious collaboration
I am new to Cakephp
Benoit

Presumably, something like $membre->grossiste->etiquette. If you used the “bake” utility, it should generate a lot of this code for you.

Hello Sir Zuluru,
I cannot bake that model table, it is an existing applicstion.
I tried: $membre->grossiste->etiquette , it did not filled the field on the view;
I tried: <td><?= h($membre->grossiste_id) ?></td>
**it showed 3 which is exactly corresponding to the proper entry in** **g****rossistes** **table****, for that member.**
``
image.png

**So I want "Ontario-Outaouais" to appear;**

Which statement would do it?

Thanks for helping me
Benoit

``

You’ve thrown a wall of code at us, far more than necessary, and as images instead of text which makes it a) harder to read and b) impossible to copy and paste and edit to help. What you’re missing is a contain clause on your Membres find, like ->contain(['Grossistes']). Adding that will read in the related record, making it available in the view. There’s a load of details about containment in the manual, I suggest you read up on it, as it’s super useful!

Sorry for this caveat; I will pay more attention from now;
Thanks for your precious collabotration
Benoit