Get Configured to Standalone Object Service

@param string $objectType

@throws Exception

@return AbstractStandaloneObject
194804
public function getObjectService(string $objectType): AbstractStandaloneObject
    {
        //====================================================================//
        // Safety Check
        if (!isset($this->taggedObjects[$objectType])) {
            throw new Exception(sprintf('Standalone Object  "%s" is not defined. Did you tag your service as  "splash.standalone.object"?', $objectType));
        }
        //====================================================================//
        // Configure Object Service
        $this->taggedObjects[$objectType]->configure($objectType, $this->getWebserviceId(), $this->getConfiguration());
        //====================================================================//
        // Connect to Object Service
        return $this->taggedObjects[$objectType];
    }
463362
private function getObjectManager($entityClassname)
    {
        $objectManager = $this->getContainer()->get('doctrine')->getManagerForClass($entityClassname);
        if ($objectManager) {
            return $objectManager;
        }

        $objectManager = $this->getContainer()->get('doctrine_mongodb')->getManagerForClass($entityClassname);
        if ($objectManager) {
            return $objectManager;
        }

        throw new \RuntimeException(sprintf('Class "%s" is not a managed entity', $entityClassname));
    }
355600
public function getDataService(string $name, string $objectType, string $schema)
    {
        $services = $this->discovery->getDataServices();
        if (isset($services[$name][$objectType][$schema])) {
            return $services[$name][$objectType][$schema];
        }

        throw new \RuntimeException('Data service not found.');
    }
530983
public function set_object_type( $object_type ) {
		if ( ! in_array( $object_type, $supported = [ 'user', 'comment', 'term', 'post' ] ) ) {
			// @codingStandardsIgnoreLine
			_doing_it_wrong( __FUNCTION__, 'The object type must be one of: ' . implode( ', ', $supported ), null );
		}

		$this->object_type = $object_type;

		return $this;
	}
395535
static public function factory($object)
    {
        if (!isset($object->type)) {
            throw new ObjectException('The object has no type.');
        }

        $type = (string)$object->type;
        if (!isset(self::$types[$type])) {
            throw new NoSupportException(sprintf('The object type "%s" is unknown or invalid.', $type));
        }

        $class = '\\Omlex\\Object\\'.self::$types[$type];
        if (!class_exists($class)) {
            throw new ObjectException(sprintf('The object class "%s" is invalid or not found.', $class));
        }

        $instance = new $class($object);
        return $instance;
    }
614529
private function flushCreates($objectType)
    {
        $result = $this->client->create($this->bulkCreateRecords[$objectType], $objectType);
        $this->bulkCreateRecords[$objectType] = array();

        return $result;
    }
534571
public function objectIdChanged(string $objectType, string $oldObjectId, string $newObjectId)
    {
        //==============================================================================
        // Create Event Object
        $event = new ObjectsIdChangedEvent($this->getWebserviceId(), $objectType, $oldObjectId, $newObjectId);
        //==============================================================================
        //      Dispatch Event
        $this->getEventDispatcher()->dispatch(ObjectsIdChangedEvent::NAME, $event);

        return true;
    }
1374897
public function getObjectManager(): ObjectManagerInterface
    {
        if (!isset($this->earlyInstances[ObjectManagerInterface::class])) {
            debug_print_backtrace();
            throw new FlowException('The Object Manager is not available at this stage of the bootstrap run.', 1301120788);
        }
        return $this->earlyInstances[ObjectManagerInterface::class];
    }
561692
protected static function getObject($objectOrClass): object
    {
        self::assertParam($objectOrClass);

        if (\is_string($objectOrClass)) {
            try {
                $objectOrClass = new $objectOrClass();
            } catch (\Error $e) {
                try {
                    $class = new \ReflectionClass($objectOrClass);
                    $objectOrClass = $class->newInstanceWithoutConstructor();
                    // @codeCoverageIgnoreStart
                } catch (\ReflectionException $exception) {
                    throw new \RuntimeException(
                        '[' . typeOf($exception) . '] ' . $exception->getMessage(),
                        (int)$exception->getCode(),
                        $exception
                    );
                }
                // @codeCoverageIgnoreEnd
            }
        }
        return $objectOrClass;
    }
267955
protected function autowireProperties(array &$objectConfigurations)
    {
        /** @var Configuration $objectConfiguration */
        foreach ($objectConfigurations as $objectConfiguration) {
            $className = $objectConfiguration->getClassName();
            $properties = $objectConfiguration->getProperties();

            if ($className === '') {
                continue;
            }
            if ($objectConfiguration->getAutowiring() === Configuration::AUTOWIRING_MODE_OFF) {
                continue;
            }

            $classMethodNames = get_class_methods($className);
            if (!is_array($classMethodNames)) {
                if (!class_exists($className)) {
                    throw new UnknownClassException(sprintf('The class "%s" defined in the object configuration for object "%s", defined in package: %s, does not exist.', $className, $objectConfiguration->getObjectName(), $objectConfiguration->getPackageKey()), 1352371371);
                } else {
                    throw new UnknownClassException(sprintf('Could not autowire properties of class "%s" because names of methods contained in that class could not be retrieved using get_class_methods().', $className), 1352386418);
                }
            }
            foreach ($classMethodNames as $methodName) {
                if (isset($methodName[6]) && strpos($methodName, 'inject') === 0 && $methodName[6] === strtoupper($methodName[6])) {
                    $propertyName = lcfirst(substr($methodName, 6));

                    $autowiringAnnotation = $this->reflectionService->getMethodAnnotation($className, $methodName, Flow\Autowiring::class);
                    if ($autowiringAnnotation !== null && $autowiringAnnotation->enabled === false) {
                        continue;
                    }

                    if ($methodName === 'injectSettings') {
                        $packageKey = $objectConfiguration->getPackageKey();
                        if ($packageKey !== null) {
                            $properties[$propertyName] = new ConfigurationProperty($propertyName, ['type' => ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, 'path' => $packageKey], ConfigurationProperty::PROPERTY_TYPES_CONFIGURATION);
                        }
                    } else {
                        if (array_key_exists($propertyName, $properties)) {
                            continue;
                        }
                        $methodParameters = $this->reflectionService->getMethodParameters($className, $methodName);
                        if (count($methodParameters) !== 1) {
                            $this->logger->debug(sprintf('Could not autowire property %s because %s() expects %s instead of exactly 1 parameter.', $className . '::' . $propertyName, $methodName, (count($methodParameters) ?: 'none')));
                            continue;
                        }
                        $methodParameter = array_pop($methodParameters);
                        if ($methodParameter['class'] === null) {
                            $this->logger->debug(sprintf('Could not autowire property %s because the method parameter in %s() contained no class type hint.', $className . '::' . $propertyName, $methodName));
                            continue;
                        }
                        $properties[$propertyName] = new ConfigurationProperty($propertyName, $methodParameter['class'], ConfigurationProperty::PROPERTY_TYPES_OBJECT);
                    }
                }
            }

            foreach ($this->reflectionService->getPropertyNamesByAnnotation($className, Inject::class) as $propertyName) {
                if ($this->reflectionService->isPropertyPrivate($className, $propertyName)) {
                    throw new ObjectException(sprintf('The property "%s" in class "%s" must not be private when annotated for injection.', $propertyName, $className), 1328109641);
                }
                if (!array_key_exists($propertyName, $properties)) {
                    /** @var Inject $injectAnnotation */
                    $injectAnnotation = $this->reflectionService->getPropertyAnnotation($className, $propertyName, Inject::class);
                    $objectName = trim(implode('', $this->reflectionService->getPropertyTagValues($className, $propertyName, 'var')), ' \\');
                    $configurationProperty =  new ConfigurationProperty($propertyName, $objectName, ConfigurationProperty::PROPERTY_TYPES_OBJECT, null, $injectAnnotation->lazy);
                    $properties[$propertyName] = $configurationProperty;
                }
            }

            foreach ($this->reflectionService->getPropertyNamesByAnnotation($className, InjectConfiguration::class) as $propertyName) {
                if ($this->reflectionService->isPropertyPrivate($className, $propertyName)) {
                    throw new ObjectException(sprintf('The property "%s" in class "%s" must not be private when annotated for configuration injection.', $propertyName, $className), 1416765599);
                }
                if (array_key_exists($propertyName, $properties)) {
                    continue;
                }
                /** @var InjectConfiguration $injectConfigurationAnnotation */
                $injectConfigurationAnnotation = $this->reflectionService->getPropertyAnnotation($className, $propertyName, InjectConfiguration::class);
                if ($injectConfigurationAnnotation->type === ConfigurationManager::CONFIGURATION_TYPE_SETTINGS) {
                    $packageKey = $injectConfigurationAnnotation->package !== null ? $injectConfigurationAnnotation->package : $objectConfiguration->getPackageKey();
                    $configurationPath = rtrim($packageKey . '.' . $injectConfigurationAnnotation->path, '.');
                } else {
                    if ($injectConfigurationAnnotation->package !== null) {
                        throw new ObjectException(sprintf('The InjectConfiguration annotation for property "%s" in class "%s" specifies a "package" key for configuration type "%s", but this is only supported for injection of "Settings".', $propertyName, $className, $injectConfigurationAnnotation->type), 1420811958);
                    }
                    $configurationPath = $injectConfigurationAnnotation->path;
                }
                $properties[$propertyName] = new ConfigurationProperty($propertyName, ['type' => $injectConfigurationAnnotation->type, 'path' => $configurationPath], ConfigurationProperty::PROPERTY_TYPES_CONFIGURATION);
            }
            $objectConfiguration->setProperties($properties);
        }
    }
1233078
public function setObjectPrototype($objectPrototype)
    {
        if (!is_object($objectPrototype)
            || (!$objectPrototype instanceof ArrayObject && !method_exists($objectPrototype, 'exchangeArray'))

        ) {
            throw new Exception\InvalidArgumentException(sprintf(
                'Object must be of type %s, or at least implement %s',
                'ArrayObject',
                'exchangeArray'
            ));
        }
        $this->arrayObjectPrototype = $objectPrototype;
        return $this;
    }
912376
public function create($resource)
    {
        $className = $this->getResourceClassName($resource->type);
        if (!class_exists($className)) {
            throw new Exception(
                'Unknown resource type "' . $resource->type . '".',
                Exception::UNKNOWN_RESOURCE_TYPE
            );
        }

        /** @var AbstractResource $object */
        $object = $this->objectManager->get($className);

        foreach ($resource as $property => $value) {
            if (!ObjectAccess::isPropertySettable($object, $property)) {
                continue;
            }
            ObjectAccess::setProperty($object, $property, $value);
        }

        $this->postProcessResources($object);

        return $object;
    }
59937
protected function buildKeyProvider(ObjectType $type)
    {
        $keyClass = $type->class;

        return function () use ($keyClass, &$type) {
            $root = new $keyClass();
            $config = $root->xTypeConfig();
            return $this->parseConfig($config);

        };
    }
1051914
protected function loadObjectCollection($objType)
    {
        $proto  = $this->modelFactory()->get($objType);
        $loader = $this->collectionLoader();
        $loader->setModel($proto);
        $loader->addFilter('active', true);

        $this->objCollection = $loader->load();

        return $this->objCollection;
    }
441521
public static function retrieveTypeObject($type)
    {
        if (!array_key_exists($type, static::$typesMap)) {
            throw new BadArgumentException('Unable create column type object with name ":type" because cannot find it', [
                'type' => $type,
            ]);
        }
        
        $class = static::$typesMap[$type];
        
        return new $class($type);
    }
504002
public function object($objectType = null): ObjectInterface
    {
        //====================================================================//
        // Build Objects Type Index Key
        $index = get_class($this->getConnector())."::".$objectType;

        //====================================================================//
        // If Object Manager is New
        if (!isset($this->objectManagers[$index])) {
            $this->objectManagers[$index] = new Manager($this->getConnector(), $objectType);
        }

        //====================================================================//
        // Return Object Manager
        return $this->objectManagers[$index];
    }
774922
final public function getObjectsList($objectType, $properties = array(), $objectURI = NULL, $objectId = NULL)
    {

        if (empty($properties)):
            if (!empty($this->propertyModel))
                $properties = array_keys($this->propertyModel);
        endif;

        $query = static::getObjectQuery($properties, "?{$this->valueGroup}property_values", NULL, $objectType, $objectURI, $objectId);

        //echo($this->withConditions) ;
        $query .= "\nGROUP BY o.object_id";
        $query .= $this->getListLookUpConditionsClause();
        $query .= $this->getListOrderByStatement();
        $query .= $this->getLimitClause();

        $total = $this->getObjectsListCount($objectType, $properties, $objectURI, $objectId); //Count first
        $results = $this->database->prepare($query)->execute();
        //Could use SQL_CALC_FOUND here but just the same as just using a second query really;
        //$queries = $this->database->getQueryLog();
        $this->resetListLookUpConditions();
        $this->setListTotal($total);

        return $results;
    }