public function getItemModelImplementation(core_kernel_classes_Resource $itemModel)
    {

        $serviceId = (string)$itemModel->getOnePropertyValue($this->getProperty(self::PROPERTY_ITEM_MODEL_SERVICE));
        if (empty($serviceId)) {
            throw new common_exception_NoImplementation('No implementation found for item model ' . $itemModel->getUri());
        }
        try {
            $itemModelService = $this->getServiceManager()->get($serviceId);
        } catch (ServiceNotFoundException $e) {
            if (!class_exists($serviceId)) {
                throw new common_exception_Error('Item model service ' . $serviceId . ' not found');
            }
            // for backward compatibility support classname instead of a serviceid
            common_Logger::w('Outdated model definition "' . $serviceId . '", please use test model service');
            $itemModelService = new $serviceId();

        }
        if (!$itemModelService instanceof \taoItems_models_classes_itemModel) {
            throw new common_exception_Error('Item model service ' . get_class($itemModelService) . ' not compatible for item model ' . $itemModelService->getUri());
        }
        return $itemModelService;
    }
public function getItemModelImplementation(core_kernel_classes_Resource $itemModel)
    {

        $serviceId = (string)$itemModel->getOnePropertyValue($this->getProperty(self::PROPERTY_ITEM_MODEL_SERVICE));
        if (empty($serviceId)) {
            throw new common_exception_NoImplementation('No implementation found for item model ' . $itemModel->getUri());
        }
        try {
            $itemModelService = $this->getServiceManager()->get($serviceId);
        } catch (ServiceNotFoundException $e) {
            if (!class_exists($serviceId)) {
                throw new common_exception_Error('Item model service ' . $serviceId . ' not found');
            }
            // for backward compatibility support classname instead of a serviceid
            common_Logger::w('Outdated model definition "' . $serviceId . '", please use test model service');
            $itemModelService = new $serviceId();

        }
        if (!$itemModelService instanceof \taoItems_models_classes_itemModel) {
            throw new common_exception_Error('Item model service ' . get_class($itemModelService) . ' not compatible for item model ' . $itemModelService->getUri());
        }
        return $itemModelService;
    }
public function getItemModelImplementation ( core_kernel_classes_Resource $ itemModel ) { $ serviceId = ( string ) $ itemModel -> getOnePropertyValue ( $ this -> getProperty ( self :: PROPERTY_ITEM_MODEL_SERVICE ) ) ; if ( empty ( $ serviceId ) ) { throw new common_exception_NoImplementation ( 'No implementation found for item model ' . $ itemModel -> getUri ( ) ) ; } try { $ itemModelService = $ this -> getServiceManager ( ) -> get ( $ serviceId ) ; } catch ( ServiceNotFoundException $ e ) { if ( ! class_exists ( $ serviceId ) ) { throw new common_exception_Error ( 'Item model service ' . $ serviceId . ' not found' ) ; } // for backward compatibility support classname instead of a serviceid common_Logger :: w ( 'Outdated model definition "' . $ serviceId . '", please use test model service' ) ; $ itemModelService = new $ serviceId ( ) ; } if ( ! $ itemModelService instanceof \ taoItems_models_classes_itemModel ) { throw new common_exception_Error ( 'Item model service ' . get_class ( $ itemModelService ) . ' not compatible for item model ' . $ itemModelService -> getUri ( ) ) ; } return $ itemModelService ; }
Get the correct implementation for a specific item model

@access public
@author Joel Bout, <joel@taotesting.com>
@param  core_kernel_classes_Resource $itemModel
@return \taoItems_models_classes_itemModel
@throws common_exception_NoImplementation
@throws common_exception_Error
Get the correct implementation for a specific item model