Coder Social home page Coder Social logo

Comments (5)

aimeos avatar aimeos commented on August 22, 2024

Don't think there will be any regressions by adding $uriBuilder->initializeObject().
Can you create a pull request?

from aimeos-typo3.

gilbertsoft avatar gilbertsoft commented on August 22, 2024

I'm wondering a little bit about your issue, because this method should be called after content object creation. Can you share your code for an exacter investigation? Perhaps there is an error in the CMS core too...

from aimeos-typo3.

pdanzinger avatar pdanzinger commented on August 22, 2024

TYPO3 itself does call the function when instantiating the object, that's not the problem.

Basically, the \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder class is configured via an object of type \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface. Usually this is automatically injected with extbase. And on its live-cycle initialize method, it copies the content object form the ConfigurationManager into itself:

class UriBuilder {
[...]
     /**
     * @param \TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager
     */
    public function injectConfigurationManager(\TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface $configurationManager)
    {
        $this->configurationManager = $configurationManager;
    }
[...]
    /**
     * Life-cycle method that is called by the DI container as soon as this object is completely built
     *
     * @return void
     */
    public function initializeObject()
    {
        $this->contentObject = $this->configurationManager->getContentObject();
    }
[...]
}

However, cli_dispatch doesn't automatically provide a content object. Aimeos creates its own ConfigurationManager and content object, and manually calls the extbase inject method. Simplified code example:

$contentObjectRenderer = $objectManager->get( 'TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer' );
$configurationManager = $objectManager->get( 'TYPO3\CMS\Extbase\Configuration\ConfigurationManager' );
$configurationManager->setContentObject( $contentObjectRenderer );

$uriBuilder = $objectManager->get( 'TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder' );
$uriBuilder->injectConfigurationManager( $configurationManager );

return uriBuilder;

The current issue is that although the configuration manager is replaced, the initialize method isn't called a second time and thus the content object reference inside the UriBuilder is still empty.

from aimeos-typo3.

gilbertsoft avatar gilbertsoft commented on August 22, 2024

OK, then it's fine because the initialize method should be called only once!

from aimeos-typo3.

aimeos avatar aimeos commented on August 22, 2024

PR is merged

from aimeos-typo3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.