Search code examples
typo3extbasesubclassingtypo3-7.6.x

Subclassing foreign Service does not work


I'm trying to subclassing the FileCollectionService class from third party extension. But it takes not place.

ext_typoscript_setup.txt:

config.tx_extbase{
persistence{
    classes{
        SKYFILLERS\SfFilecollectionGallery\Service\FileCollectionService {
            subclasses {
                TxFileCollectionService = FalkRoeder\MyExt\Service\FileCollectionService
            }
        }

    }
}

}

my FileCollectionService.php put in Classes/Service

<?php
namespace FalkRoeder\MyExt\Service;

/**
 * FileCollectionService
 */
class FileCollectionService extends \SKYFILLERS\SfFilecollectionGallery\Service\FileCollectionService {

    /**
     * @return array
     */
    public function methodToOverwrite() {
    ...
    }
}

Solution

  • to get it work, I needed to add the following code to ext_typoscript_setup.txt:

    config.tx_extbase {
        objects {
            SKYFILLERS\SfFilecollectionGallery\Service\FileCollectionService.className = FalkRoeder\MyExt\Service\FileCollectionService
        }
    }