/** * Factory method for returning a singleton instance of sorter * * @param Tx_PtExtlist_Domain_Configuration_ConfigurationBuilder $configurationBuilder * @return Tx_PtExtlist_Domain_Model_Sorting_Sorter */ public function getInstance(Tx_PtExtlist_Domain_Configuration_ConfigurationBuilder $configurationBuilder) { $listIdentifier = $configurationBuilder->getListIdentifier(); if ($this->instances[$listIdentifier] === null) { $this->instances[$listIdentifier] = $this->objectManager->get('Tx_PtExtlist_Domain_Model_Sorting_Sorter'); $this->instances[$listIdentifier]->_injectSorterConfig($configurationBuilder->buildSorterConfiguration()); // At the moment we have to build list header here, as it is not registered in sorter otherwise. // TODO refactor this! We can register list header after sorter is build! $listHeaderFactory = $this->objectManager->get('Tx_PtExtlist_Domain_Model_List_Header_ListHeaderFactory'); /* @var $listHeaderFactory Tx_PtExtlist_Domain_Model_List_Header_ListHeaderFactory */ $listHeaderFactory->createInstance($configurationBuilder); } return $this->instances[$listIdentifier]; }