Site view model not importing selected classes correctly #943

Closed
opened 2022-08-03 10:41:07 +00:00 by SimonvanDoorne · 7 comments
Member

Steps to reproduce the issue

  1. Create admin view and select any class to be loaded in the Site Admin View
    Model Header
    image
  2. Download compiled zip and look at the file site/models/#adminviewname#.php

Expected result

Expectations are that the class is loaded in the file
image

Actual result

The actual result is that it's not
image

Important note is selecting this same class in the admin view model does work
image
Looking at the compiled zip again in file admin/models/#adminviewname#.php shows it that the class loads correctly in the admin model.
image

System information (as much as possible)

  • OS Name & Version: Windows 10
  • MySql Version:
  • Apache Version:
  • PHP Version: 7.4
  • Joomla Version: 3.10.10
  • JCB Version: 3.1.4
  • Browser: Firefox

Additional comments

I've went down the rabbit hole of the compiler and looked at the plugin componentbuilderheaderscompiler but i did not understand the $targets var properly to fully debug it

### Steps to reproduce the issue 1) Create admin view and select any class to be loaded in the Site Admin View Model Header ![image](/attachments/f05a86d6-295e-42d0-81ac-7c04100c60e3) 2) Download compiled zip and look at the file site/models/#adminviewname#.php ### Expected result Expectations are that the class is loaded in the file ![image](/attachments/73626c54-70ea-4ce0-8210-a513976c57ec) ### Actual result The actual result is that it's not ![image](/attachments/eec10be3-2f4f-45a6-ad83-c895b0f4baae) **Important** note is selecting this same class in the admin view model *does* work ![image](/attachments/d99819d9-cf06-4618-87e3-9fdccc6c9a49) Looking at the compiled zip again in file admin/models/#adminviewname#.php shows it that the class loads correctly in the admin model. ![image](/attachments/80444b62-75f6-4cf7-8626-f76c8952bdfc) ### System information (as much as possible) - OS Name & Version: Windows 10 - MySql Version: - Apache Version: - PHP Version: 7.4 - Joomla Version: 3.10.10 - JCB Version: 3.1.4 - Browser: Firefox ### Additional comments I've went down the rabbit hole of the compiler and looked at the plugin componentbuilderheaderscompiler but i did not understand the $targets var properly to fully debug it
Owner

The headers in the site view also has a plural and a singular option which is determind by the kind of mainGet method that is added to the site view.

So if you select a main getListQuery you should use the Target Site Views Model Header

image

And if you use a main getItem you should use the Target Site View Model Header

image

Have you made this destiction?

The headers in the site view also has a plural and a singular option which is determind by the kind of mainGet method that is added to the site view. So if you select a main `getListQuery` you should use the `Target Site Views Model Header` ![image](/attachments/f5fc622c-ecab-49e5-8038-0e1bf4cae0a1) And if you use a main `getItem` you should use the `Target Site View Model Header` ![image](/attachments/92f76ea8-fc98-48fc-bd61-20b6053b0216) Have you made this destiction?
Author
Member

I realise i did not mention this properly. My post is about the site edit view that is created when you select 'add+menu' in the admin views in your component. like this:
image

I'm not talking about site views that you create yourself in JCB

I realise i did not mention this properly. My post is about the site edit view that is created when you select 'add+menu' in the admin views in your component. like this: ![image](/attachments/bc08681f-058f-47d9-b965-3391d5428c15) I'm **not** talking about site views that you create yourself in JCB
4.9 KiB
Owner

Okay they also have their own header model called Target Site Admin View Model Header

image

Can you check that you have them also selected with the needed details? We build it like that so that you can target those header directly without also adding those classes to the admin area.

Okay they also have their own header model called `Target Site Admin View Model Header` ![image](/attachments/de01697c-f8ed-4d19-8995-df9cf8319e74) Can you check that you have them also selected with the needed details? We build it like that so that you can target those header directly without also adding those classes to the admin area.
Author
Member

Yes the site admin view model header is selected
image

Yes the site admin view model header is selected ![image](/attachments/3b987973-6f71-4060-a94a-570bef1ec829)
Owner

Apoligies...

Okay so in the e_Interpretation.php method setFileHeader on line 22533:

image

We have a switch that gets triggered on the target site.admin.view.model:

image

Add the data of that area is stored by the plugin site_admin_view_model field:

image

So a ran a quick search in the f_Infusion.php class and found the call to this target site.admin.view.model on line 660:

image

This seems all to line up... hmmm

I will do a manual test later and see if I can find the bug... this info is to show you where I normally look to make sure that all key/code words are correct.

Apoligies... Okay so in the e_Interpretation.php method `setFileHeader` on line 22533: ![image](/attachments/10d3c57a-4e5a-4496-afa5-05d082cbe3e3) We have a switch that gets triggered on the target `site.admin.view.model`: ![image](/attachments/4817f6f3-f302-4ca6-8935-db3dec224a23) Add the data of that area is stored by the plugin `site_admin_view_model` field: ![image](/attachments/82cac310-5327-40e0-8af3-08cec4966179) So a ran a quick search in the f_Infusion.php class and found the call to this target `site.admin.view.model` on line 660: ![image](/attachments/595fbab1-11a0-4f08-ad10-9e89a7c8dbe1) This seems all to line up... hmmm I will do a manual test later and see if I can find the bug... this info is to show you where I normally look to make sure that all key/code words are correct.
Author
Member

I may have cracked the code. I hijacked the process a bit and dumped some data out and came up with this:

image

In the 'componentbuilder headers compiler' plugin the var $this->activeHeaders is called but that does not contain the site.admin.view.model but does use all other selected fields.

Adding further to this i looked in the $targets var and saw that the site_admin_view_model was only defined in the site view headers. Meaning that the model for the site_admin_view never gets called no matter what you select in the admin view settings. Adding this to the file /plugins/extension/componentbuilderheaderscompiler/componentbuilderheaderscompiler.php:
image
Resolves the issue
image

I may have cracked the code. I hijacked the process a bit and dumped some data out and came up with this: ![image](/attachments/2cc8f782-a7c8-45d9-b2e0-be44beefb2d8) In the 'componentbuilder headers compiler' plugin the var `$this->activeHeaders` is called but that does **not** contain the site.admin.view.model but does use all other selected fields. Adding further to this i looked in the `$targets` var and saw that the site_admin_view_model was only defined in the site view headers. Meaning that the model for the site_admin_view never gets called no matter what you select in the admin view settings. Adding this to the file `/plugins/extension/componentbuilderheaderscompiler/componentbuilderheaderscompiler.php`: ![image](/attachments/5ebebe2f-7864-4e60-8835-cb97512165cc) Resolves the issue ![image](/attachments/3e1e4d2d-76d4-4f18-ad06-08d620875f7e)
Llewellyn added the
Bug
label 2022-08-05 08:34:42 +00:00
Llewellyn added this to the Compiler Improvements project 2022-08-05 08:35:09 +00:00
Member

Just curious if there has been any progress on this as I'm running into the same issue?

I just installed the 3.1.12 tag of JCB and it doesn't look like anything has changed there yet.

Just curious if there has been any progress on this as I'm running into the same issue? I just installed the 3.1.12 tag of JCB and it doesn't look like anything has changed there yet.
Sign in to join this conversation.
No Milestone
No Assignees
3 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: joomla/Component-Builder#943
No description provided.