Hi Alfonsas,
this will not work for extended classes. IDE will not autocomplete
$oArticle->myMethod().
I think it's a nice idea, but a little too much just for enabling
autocompletion.
Am 10.05.2011 um 11:27: schrieb Alfonsas Cirtautas:
> Hi,
>
> Did you considered just using PHPDoc for autocomplete type hinting ?
>
> /* @var $oArticle oxArticle */
> $oArticle = oxNew('oxarticle');
>
> Tested on Zend studio and NetBeans
>
> Alf
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Stefan Krenz
> Sent: Tuesday, May 10, 2011 11:49 AM
> To: [email protected]
> Subject: [oxid-dev-general] Idea to replace the "oxNew" function
>
> Hi,
>
> with my colleagues, we thought about the "oxNew" function and we came to the
> conclusion that it's possible to (re)enable the auto-completion for IDEs.
>
> We have searched a way to replace this function and here is the result of our
> brainstorming.
> It should be faster and additionally gives OXID the ability to control, which
> classes can be extended/overwritten.
>
> Three steps to realize our idea:
> 1. All classes should be renamed to *Base (eg. oxArticle to
> oxArticleBase) and an empty class which extends the *Base or the last module
> class (eg. class oxArticle extends oxArticleBase {}) is created.
> 2. If the user clicks "Save" in admin area (and right after a fresh setup),
> the class chain must be created and saved in one huge PHP-File (eg.
> moduleparents.php, further called as "MP").
> 3. Now new instances can be created with the PHP default way (eg.
> $oArticle = new oxArticle();) and "oxNew" can be removed.
>
> An example with oxArticle and 2 modules ("mfArticle" and "azArticle", in that
> order).
> The base class should be "oxArticleBase" and the last class in chain
> "oxArticle". The class chain is as follows:
>
> File: oxarticlebase.php
> class oxArticleBase extends oxBase {...}
>
> File: MP (saved on click on "Save" in admin) class mfArticle_parent extends
> oxArticleBase {}
>
> File: mfarticle.php
> class mfArticle extends mfArticle_parent {...}
>
> File: MP
> class azArticle_parent extends mfArticle {}
>
> File: azarticle.php
> class azArticle extends azArticle_parent {...}
>
> File: MP
> class oxArticle extends azArticle {}
>
> The MP file looks like:
> <?php
> class mfArticle_parent extends oxArticleBase {} // core class class
> azArticle_parent extends mfArticle {} // core class class oxArticle extends
> azArticle {} // core class
>
> // examples without modules
> class oxArticleList extends oxArticleListBase {} // core class class
> oxCategory extends oxCategoryBase {} // core class class account_main extends
> account_mainBase {} // view class ?>
>
> So if you create an instance of "oxArticle", you will get an object with all
> (overwritten) methods/properties.
> In addition, the includes can be written to the MP file, for faster class
> loading. Another way was, to write class paths to the MP file and let the
> autoloader load required files.
>
> Another effect: Developers can clearly see, which classes can be
> extended/overwritten.
>
> For backward-compatibility the autoloader must be changed a little bit.
>
>
> What do you think about this solution?
>
> Best regards
> Stefan Krenz
>
>
> --
> Stefan Krenz Mayflower GmbH
> Pleichertorstraße 2 Tel.: +49 931 359 65 1163
> D-97070 Würzburg Fax : +49 931 359 65 28
> [email protected] http://www.mayflower.de
>
> Mayflower GmbH, Standort Würzburg
> Firmensitz: Mannhardtstraße 6, 80538 München
> Registergericht: Amtsgericht München, HRB 142039
> Geschäftsführer: Gregor Streng, Björn Schotte, Albrecht Günther, Johann-Peter
> Hartmann _______________________________________________
> dev-general mailing list
> [email protected]
> http://dir.gmane.org/gmane.comp.php.oxid.general
> _______________________________________________
> dev-general mailing list
> [email protected]
> http://dir.gmane.org/gmane.comp.php.oxid.general
_______________________________________________
dev-general mailing list
[email protected]
http://dir.gmane.org/gmane.comp.php.oxid.general