Issue Bug Closed

#61995Extbase: Overwriting objects by TS not working in CommandController?

Vitoandre D'Oria 10/01/14, 18:06 updated 10/02/18, 11:51

Description

plugin.tx_ext {
    objects {
        TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface {
            className = MY\Ext\Configuration\ConfigurationManager
        }
        TYPO3\CMS\Extbase\Configuration\BackendConfigurationManager {
            className = MY\Ext\Configuration\BackendConfigurationManager
        }
    }
}
module.tx_ext < plugin.tx_ext

    MyCommand($pid) {
        $this->configurationManager = $this->objectManager->get('\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface');
        $this->configurationManager->setCurrentPageId($pid);
    }

I also got the following questions:
1.) Why aren’t we able to change the pid in BE? For Tasks its possible to obtain a pid but since you initially set this value we are not able to just do $_POST[‘id’] = $pid; afterwards. Neither we are able to overwrite the pid.

2.) Documentation of this objects Syntax is not existing? I just found some old config.tx_extbase example blogs and the code here: https://review.typo3.org/#/c/16855/4/Classes/Core/Bootstrap.php makes no sense (at least to me).
Why $classNameWithDot ???

From \TYPO3\CMS\Extbase\Object\Container\Container i would guess i have to overwrite the interface instead the concrete class!? Does this make a difference (in both cases its not working for me)?:


    /**
     * register a classname that should be used if a dependency is required.
     * e.g. used to define default class for a interface
     *
     * @param string $className
     * @param string $alternativeClassName
     */
    public function registerImplementation($className, $alternativeClassName) {
        $this->alternativeImplementation[$className] = $alternativeClassName;
    }

Hope someone explains that feature or points me to a wiki? page that isn’t completely outdated. I also wouldn’t mind it if the source code was better documented e.g. samples like the one given here :-)

ps. does this feature also have a official name? Searching for className, objects TypoScript isn’t that great.

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.