Bug #88358

CLI Scheduler not evaluating extbase overwritten classes

Added by Pascal Querner 12 days ago. Updated 12 days ago.

Status:
New
Priority:
Should have
Assignee:
-
Category:
Extbase
Target version:
-
Start date:
2019-05-15
Due date:
% Done:

0%

TYPO3 Version:
9
PHP Version:
7.2
Tags:
extbase, scheduler, cli
Complexity:
Is Regression:
Sprint Focus:

Description

We overwrite couple of classses of pxa_social_feed [1] to extend functionality like so:

config.tx_extbase {

    persistence {
        classes {
            Pixelant\PxaSocialFeed\Domain\Model {
                subclasses {
                    0 = snip\snip\Domain\Model\PxaFeed
                }
            }

            snip\snip\Domain\Model\PxaFeed {
                mapping {
                    tableName = tx_pxasocialfeed_domain_model_feed
                    # recordType = 0
                }
            }
        }
    }

    objects {
        Pixelant\PxaSocialFeed\Controller\FeedsController.className = snip\snip\Controller\PxaFeedsController
        Pixelant\PxaSocialFeed\Domain\Repository\FeedRepository.className = snip\snip\Domain\Repository\PxaFeedRepository
    }
}

And we also add a new task for ext:scheduler which is extending the import task of ext:pxa_social_feed [0] (we simply call our taskutlity there and not the original, but keep all the original functionality (like getting the configuration)).

In ImportTaskUtility.php of ext:pxa_social_feed (a php class which is used for ext:scheduler) a new model is either fetched from the database or created for you via objectmanager [2].
This works all well in CGI mode, when you call that scheduler manually. However, in CLI mode the fetched class is of original type (of ext:pxa_social_feed) and not of extended type, and therefore will be ignored to add with exception code 1248363335 .[3]

As a hotfix I delcared the method 'saveInstagramFeed' of ext:pxa_social_feed protected in a fork which allowed me to overwrite it (and ask the objectmanager to fetch my model always). [4]

Is there something I did wrong with extending the classes or does CLI just not care about extbase config?

I've only tested this against TYPO3 9.5.5 and 9.5.6, no earlier versions.

[0] https://github.com/pixelant/pxa_social_feed/blob/v1.10.0/Classes/Task/ImportTask.php
[1] https://github.com/pixelant/pxa_social_feed
[2] https://github.com/pixelant/pxa_social_feed/blob/v1.10.0/Classes/Utility/Task/ImportTaskUtility.php#
[3] https://github.com/TYPO3/TYPO3.CMS/blob/v9.5.5/typo3/sysext/extbase/Classes/Persistence/Repository.php#L77
[4] https://github.com/pixelant/pxa_social_feed/blob/v1.10.0/Classes/Utility/Task/ImportTaskUtility.php#L418

History

#1 Updated by Pascal Querner 12 days ago

I forgot to mention that the config.tx_extbase is inside a ext_typoscript_setup.txt file which is in a custom extension.

Also available in: Atom PDF