Can't get my view class instanciated.

31 views
Skip to first unread message

Yves Dangel

unread,
Feb 16, 2016, 9:23:40 AM2/16/16
to Joomlatools Developers
Hi All,

I have a simple problem.
I want to use /administrator/components/immad/views/maison_smodele/html.php to inject computed values
 in /administrator/components/immad/views/maison_smodele/tmpl/default.html.php

Here is /administrator/components/immad/views/maison_smodele/html.php


class ComImmadViewMaison_smodeleHtml extends ComKoowaViewHtml
{
   
protected function _fetchData(KViewContext $context)
   
{
        parent
::_fetchData($context);
       
 
........

   
}
   

}



But this class is not instanciated. (even with a syntax error, the page is displayed correctly.)
I have no customized controller.


What is wrong ?

Thanks in advance

Johan Janssens

unread,
Feb 17, 2016, 6:11:34 AM2/17/16
to Joomlatools Developers
Hello Yves,

What is happening is that the framework is not able to find your view, probably due to the naming you are using. It's always advised to use proper naming conventions as explained here : https://www.joomlatools.com/developer/framework/essentials/naming-conventions/ For your view pleas use ComImmadViewMaisonsHtml or ComImmadViewMaisonHtml for the item view.

You can then use view=maisons or view=maison in your url to get to the view.

Does that help you ?

Johan

Yves Dangel

unread,
Feb 17, 2016, 7:44:07 AM2/17/16
to Joomlatools Developers
Hello Johan,

I think I respect the naming convention. In the naming conventions page, I c( You can use underscores in the file name as well. )

I have Maison_smodele and Maison_smodeles views and the template name (/
immad/views/maison_smodele/tmpl/default.html.php)is well recognized.

I 'm going to test your solution

Johan Janssens

unread,
Feb 17, 2016, 6:48:25 PM2/17/16
to Joomlatools Developers
It's possible yes, but not ideal, try it with the normal naming first and see if that works. Very likely this is a naming issue.

Johan

Yves Dangel

unread,
Feb 18, 2016, 9:08:35 AM2/18/16
to Joomlatools Developers
Hi Johan,

I have changed to a non underscored view name, it's working well.

It looks like a bug, since it works well for all underscored filenames (controller, model, entity,database ...)

But it's not really bound to directory name process as it works with templates which are also inside an underscored name category .

Thanks


Johan Janssens

unread,
Feb 18, 2016, 7:20:16 PM2/18/16
to Joomlatools Developers
Hi Yves, 

Great to hear it works. If you can track the bug you can submit a PR for that. You can find our contribution guidelines here : https://www.joomlatools.com/developer/contribute/

Cheers,

Johan

Yves Dangel

unread,
Feb 20, 2016, 10:37:13 AM2/20/16
to Joomlatools Developers
Hi Johan,

In fact, the problem is in the class name evaluation in KObjectLocatorComponent. I have try to make a correct PR, but I am not really GIT skilled .
I have mixed this PR with an old commit.




Johan Janssens

unread,
Mar 7, 2016, 7:13:31 PM3/7/16
to Joomlatools Developers
Thanks Yves, received your PR. Will work on this and see if I can get it committed for you.

Thanks heaps!

Johan

Johan Janssens

unread,
Apr 10, 2016, 6:09:12 PM4/10/16
to Joomlatools Developers
Hello Yves,


Thanks again for your contribution. Very much appreciated. I have split your PR into seperate issues, which you can find here:


The issues are made against the new Kodekit repo which is the rebranded repo for Nooku Framework for the 3.0 release. The repo forms the basis for our Joomlatools Framework which you can now find here https://github.com/joomlatools/joomlatools-framework

The team will now review the PR's I did and if they are tested will also merge them into Joomlatools Framework for the next maintenance release. I will let you know once the merge is done and both changes are released. 

Thanks again!

Johan

Yves Dangel

unread,
Apr 11, 2016, 4:06:31 PM4/11/16
to Joomlatools Developers
Hi johan,

I'm glad if I could help you.

But I am still wondering how your new process keep the underscore in the path part of the class name.
ie class ComMycomViewUnder_scoreHtml and not ComMycomViewUnderscoreHtml (before : ComMycomViewUnderScoreHtml)

That would not be really in the same logic as other class names (ex ComMycomModelUnder_score).

Am I wrong ?






Johan Janssens

unread,
Apr 11, 2016, 7:57:39 PM4/11/16
to Joomlatools Developers
Hello Yves,

The component locator is now using StringInflector::implode() and I refactored this method to only create a camelcased word based on the arra that is passed. This solves your issue and ensure that '_' in the path of the identifier are kept.

Hope that helps,

Johan

Johan Janssens

unread,
Apr 12, 2016, 12:06:15 PM4/12/16
to Joomlatools Developers
Hello Yves,

Quick update, we have included the fix in Joomlatools Framework for the 2.2.0 release. See also: https://github.com/joomlatools/joomlatools-framework/issues/3

Happy coding!

Johan
Reply all
Reply to author
Forward
0 new messages