Get the appropriate {@link CatalogueProductController} or
{@link CatalogueProductController} for handling the relevent
object.

@param $object A {@link DataObject} with the getControllerName() method
@param string $action
@return CatalogueController
772563
public static function controller_for_object($object, $action = null)
    {
        $controller = $object->getControllerName();

        if ($action && class_exists($controller . '_' . ucfirst($action))) {
            $controller = $controller . '_' . ucfirst($action);
        }

        return Injector::inst()->create($controller, $object);
    }
1064979
private function withDirectObjectReference($object) : self
    {
        Assert::isObject($object, "Direct reference passed to service activator must be object");

        $this->directObjectReference = $object;

        return $this;
    }
474221
public static function get_for_object($object)
    {
        // Capture changesetitem for both changed and deleted objects
        $id = $object->isInDB()
            ? $object->ID
            : $object->OldID;
        return static::get_for_object_by_id($id, $object->baseClass());
    }
398530
public function loadMetadataForAction($controllerClassName, $actionMethod)
    {
        $key = $controllerClassName . '_' . $actionMethod;
        if (array_key_exists($key, $this->classAnnotations)) {
            return $this->classAnnotations[$key];
        }

        $r = new ReflectionClass($controllerClassName);
        $rMethod = $r->getMethod($actionMethod);

        $metadata = new Metadata();


        /** @var Annotation\RunWorkflowParamFromRoute|null $workflowRouterMapAnnotation */
        $workflowRouterMapAnnotation = $this->getReader()->getMethodAnnotation($rMethod, Annotation\RunWorkflowParamFromRoute::class);
        if ($workflowRouterMapAnnotation) {
            $metadata->setWorkflowManagerNameRouterParam($workflowRouterMapAnnotation->managerName);
            $metadata->setWorkflowManagerAliasRouterParam($workflowRouterMapAnnotation->managerAlias);
            $metadata->setWorkflowActionNameRouterParam($workflowRouterMapAnnotation->actionName);
            $metadata->setWorkflowNameRouterParam($workflowRouterMapAnnotation->name);
            $metadata->setEntryIdRouterParam($workflowRouterMapAnnotation->entryId);
        }

        return $metadata;
    }
1313575
protected function searchController(
        /*# string */ $controller,
        /*# string */ $action
    )/*# : callable */ {
        $controllerName = $controller . $this->controller_suffix;
        $actionName = $action . $this->action_suffix;
        foreach ($this->namespaces as $ns) {
            $class = $ns . '\\' . $controllerName;
            if (class_exists($class)) {
                $obj = new $class();
                return [$obj, $actionName];
            }
        }
        throw new LogicException(
            Message::get(Message::RTE_HANDLER_UNKNOWN, $controller),
            Message::RTE_HANDLER_UNKNOWN
        );
    }
409615
protected function getControllerAction()
    {
        $action = $this->path['action'];
        if (is_array($action)) {
            return action($action[0], array_slice($action, 1));
        }

        return action($action);
    }
78332
public function objectAction(string $name) : Action\ObjectActionDefiner
    {
        return new ObjectActionDefiner(
            $this->dataSource,
            $this->authSystem,
            $this->requiredPermissions,
            $name,
            function (IObjectAction $action) {
                $this->actions[$action->getName()] = $action;
            }
        );
    }
1307522
public static function getClass($object)
    {
        $inflector                       = self::$classNameInflector
            ?? self::$classNameInflector = (new Configuration())->getClassNameInflector();

        return $inflector->getUserClassName(get_class($object));
    }
1065220
protected function getActionUrl($action) : string
    {
        $context = Context::getInstance();
        return $context->getUrl($context->getParameter('controller_path') . $action);
    }
990634
public function getDataTransferObjectName($object) {
		$objectName = TypeHandling::getTypeForValue($object);

		if (!array_key_exists($objectName, $this->classMappingConfiguration)) {
			foreach (array_reverse($this->classNameToDtoClassNameReplaceFragments, TRUE) as $dtoClassNameFragment => $classNameFragment) {
				$dtoClassName = str_replace($classNameFragment, $dtoClassNameFragment, $objectName);
				if (class_exists($dtoClassName)) {
					$this->classMappingConfiguration[$objectName] = $dtoClassName;
					break;
				}
			}
		}

		if (!isset($this->classMappingConfiguration[$objectName])) {
			throw new InvalidTargetException(sprintf('There is no DTO class name for "%s" objects.', $objectName), 1407499486);
		}

		return $this->classMappingConfiguration[$objectName];
	}
313352
private function getControllerActionEventName($controller, $actionName)
    {
        if (!is_object($controller)) {
            throw new \InvalidArgumentException('Controller must be type of object, '.gettype($controller).' given.');
        }

        $eventName = str_replace('\\', '.', strtolower(get_class($controller)));

        if (0 === strpos($eventName, 'backbee.')) {
            $eventName = str_replace('backbee.', '', $eventName);
        }

        if (0 === strpos($eventName, 'frontcontroller.')) {
            $eventName = str_replace('frontcontroller.', '', $eventName);
        }

        return $eventName.'.'.strtolower($actionName);
    }
336662
public function link($action = null)
    {
        if ($action) {
            return Controller::join_links($this->link, $action);
        }

        return $this->link;
    }
227125
public function getController(string $name = '')
    {
        if (empty($name)) {
            $name = $this->getComponentsName();
        }

        $controller = $this->MVCFactory($name, 'Controller');

        return $controller;
    }
268307
protected function driverAction(/*# string */ $action, $item)/*# : bool */
    {
        if (is_null($item)) {
            return $this->getDriver()->{$action}();
        } else {
            return $this->getDriver()->{$action}($item);
        }
    }
1060416
public static function initializeByObject(stdClass $Object) {
        $Receipt = new self();

        if (isset($Object->app_item_id)) {
            $Receipt->setAppItemId($Object->app_item_id);
        }

        if (isset($Object->bid)) {
            $Receipt->setBid($Object->bid);
        }

        if (isset($Object->bvrs)) {
            $Receipt->setBvrs($Object->bvrs);
        }

        if (isset($Object->product_id)) {
            $Receipt->setProductId($Object->product_id);
        }

        if (isset($Object->quantity)) {
            $Receipt->setQuantity($Object->quantity);
        }

        if (isset($Object->transaction_id)) {
            $Receipt->setTransactionId($Object->transaction_id);
        }

        if (isset($Object->original_transaction_id)) {
            $Receipt->setOriginalTransactionId($Object->original_transaction_id);
        }

        if (isset($Object->purchase_date)) {
            $Receipt->setPurchaseDate($Object->purchase_date);
        }

        if (isset($Object->original_purchase_date)) {
            $Receipt->setOriginalPurchaseDate($Object->original_purchase_date);
        }

        if (isset($Object->cancellation_date)) {
            $Receipt->setCancellationDate($Object->cancellation_date);
        }

        return $Receipt;
    }
1271853
public function objectUrl($code, $action, $object, $parameters = [], $absolute = UrlGeneratorInterface::ABSOLUTE_PATH)
    {
        list($action, $code) = $this->getCodeAction($code, $action);

        return $this->getAdminPool()->getAdminByAdminCode($code)->generateObjectUrl($action, $object, $parameters, $absolute);
    }
642551
private function getDb($transaction, $object)
    {
        if($object instanceof \Imi\Model\Model)
        {
            $db = Db::getInstance(ModelManager::getDbPoolName($object));
        }
        else
        {
            $db = Db::getInstance($transaction->dbPoolName);
        }
        return $db;
    }