[TYPO3-mvc] How to extend Felogin with Xclass (again)
Markus Klein
klein.t3 at mfc-linz.at
Tue Sep 17 13:11:28 CEST 2013
Hi Jigal,
>
> Hi,
>
> On 16-9-2013 19:22, Markus Klein wrote:
> > XCLASSing means you have to provide a complete copy of the original file
> modified by you.
>
> No, the new class simply extends the old class and can override functions in
> the old class or add new data members and methods.
I know that, but the original question was just:
" In this class I put the method I want to override. But there a no changes to see. What could this be?"
>
> > It does NOT suffice to simply specify one method there, like overriding a
> method when extending a class.
This sentence completed my saying that a function alone is not enough. Inheritance is of course possible.
>
> It can be used to override one method. It's even possible to call the old
> method in your new version:
>
> class ux_someclass extends someclass {
>
> public function foo($bar) {
>
> $result = parent::foo($bar);
> $result .= 'extra stuff';
> return $result;
> }
> }
>
> This way the code in the original function can change a bit but this will not
> influence the total functionality.
>
> > This is the reason why XCLASSing is depracted.
>
> It's not really deprecated. In 4.x versions it relied on some code in the end of
> the original class. This has been removed in 6.x and a new method for
> extending classes has been introduced:
>
> http://wiki.typo3.org/XCLASS#XCLASS_registration_since_TYPO3_CMS_6.0
>
> --
> Jigal van Hemert
> TYPO3 CMS Active Contributor
Kind regards
Markus
------------------------------------------------------------
Markus Klein
TYPO3 CMS Active Contributors Team Member
More information about the TYPO3-project-typo3v4mvc
mailing list