Fetch the variables from the given content type object.

@param PageInterface $object
@param $fieldName
@param null $method

@return mixed

@throws \Sonata\AdminBundle\Exception\NoValueException
515371
public static function getFieldValue(PageInterface $object, $fieldName, $method = null)
    {
        $getters = [];
        // prefer method name given in the code option
        if ($method) {
            $getters[] = $method;
        }

        $camelizedFieldName = self::camelize($fieldName);
        $getters[] = 'get'.$camelizedFieldName;
        $getters[] = 'is'.$camelizedFieldName;

        foreach ($getters as $getter) {
            if (method_exists($object, $getter)) {
                return call_user_func([$object, $getter]);
            }
        }

        throw new NoValueException(sprintf('Unable to retrieve the value of `%s`', $camelizedFieldName));
    }
987879
public static Field getField(String fieldName, Object object) {
    return getField(fieldName, object.getClass());
  }
711443
public function renderObjectCall(
        VariableAwareInterface $object,
        $method,
        array $arguments = [],
        $semicolon = false,
        $newLine = false
    ) {
        return $this->renderCall(
            $this->renderProperty($object->getVariable(), $method),
            $arguments,
            $semicolon,
            $newLine
        );
    }
1200868
public function get(string $variableName = null, int $type = Variables::TYPE_ARRAY)
    {
        if ($variableName === null) {
            throw new BadMethodCallException('Variable name must be specified');
        }
        if (isset($this->variables['MFVARS'][$variableName])) {
            return $this->variables['MFVARS'][$variableName];
        }
        if (isset($this->variables[$variableName])) {
            return $this->variables[$variableName];
        }
        return [];
    }
442938
public function getPage($pageNumber)
    {
        $response = $this->makeQuery($pageNumber);
        $className = $this->typeClass->objectClass;
        $objects = array();
        if (!isset($response->data) || !$response->data)
            return array();
        foreach ($response->data as $object) {
            $objects[] = new $className($this->api, $this->typeClass, $object);
        }

        return $objects;
    }
1029319
public static function collect(string $className, $objectAnnotation = null, string $propertyName = "", string $methodName = "", $propertyValue = null)
    {
        if ($objectAnnotation instanceof Process) {

            $num       = $objectAnnotation->getNum();
            $name      = $objectAnnotation->getName();
            $boot      = $objectAnnotation->isBoot();
            $inout     = $objectAnnotation->isInout();
            $pipe      = $objectAnnotation->isPipe();
            $coroutine = $objectAnnotation->isCoroutine();
            $name      = empty($name) ? $className : $name;

            self::$processes[$name] = [
                'name'  => $name,
                'num'   => $num,
                'boot'  => $boot,
                'pipe'  => $pipe,
                'inout' => $inout,
                'co'    => $coroutine,
                'class' => $className,
            ];

            return;
        }
    }
24590
public function getField($fieldName)
    {
        $this->debug->group(__METHOD__, $fieldName);
        $field = false;
        if (\preg_match('|^(.*?)[/.](.*)$|', $fieldName, $matches)) {
            $pageName = $matches[1];
            $fieldName = $matches[2];
        } else {
            $pageName = $this->status['currentPageName'];
        }
        if ($pageName == $this->status['currentPageName'] && isset($this->currentFields[$fieldName])) {
            $field = &$this->currentFields[$fieldName];
            if (!\is_object($field)) {
                $field['pageI'] = $this->persist->get('i');
                $this->currentFields[$fieldName] = $this->buildField($field, $fieldName);
            }
        } elseif (isset($this->cfg['pages'][$pageName])) {
            $pages = $this->persist->get('pages');
            foreach ($pages as $pageI => $page) {
                if ($page['name'] != $pageName) {
                    continue;
                }
                foreach ($this->cfg['pages'][$pageName] as $k => $fieldProps) {
                    if ($k === $fieldName
                        || isset($fieldProps['attribs']['name']) && $fieldProps['attribs']['name'] == $fieldName
                        || isset($fieldProps['name']) && $fieldProps['name'] == $fieldName
                    ) {
                        $this->debug->info('found field');
                        $fieldProps['pageI'] = $pageI;
                        $field = $this->buildField($fieldProps, $k);
                        $val = $this->getValue($fieldName, $pageI);
                        $field->val($val, false);
                        break 2;
                    }
                }
                break;
            }
        }
        $this->debug->groupEnd();
        return $field;
    }
18418
public static Object get(PageContext pc, Object coll, int[] types, Key[] keys, Object[][] args, Object defaultValue) throws PageException {
	if (coll == null) return defaultValue;
	int to = keys.length - 1;
	VariableUtilImpl vu = (VariableUtilImpl) pc.getVariableUtil();
	for (int i = 0; i <= to; i++) {
	    switch (types[i]) {
	    case TYPE_DATA:
		coll = vu.getCollection(pc, coll, keys[i], Null.NULL);
		break;
	    case TYPE_UDF_ARGS:
		coll = vu.callFunctionWithoutNamedValues(pc, coll, keys[i], args[i], false, Null.NULL);
		break;
	    case TYPE_UDF_NAMED_ARGS:
		coll = vu.callFunctionWithNamedValues(pc, coll, keys[i], args[i], false, Null.NULL);
		break;
	    case TYPE_BIF:
		coll = null;// TODO
		break;
	    }

	    if (coll == Null.NULL || (coll == null && i < to)) return defaultValue;
	}
	return coll;
    }
219080
public static function collect(
        string $className,
        $objectAnnotation = null,
        string $propertyName = '',
        string $methodName = '',
        $propertyValue = null
    ) {
        if ($objectAnnotation instanceof Statement) {
            $driver                    = $objectAnnotation->getDriver();
            self::$statements[$driver] = $className;
        }
    }
982149
public function getPagesByName(
        SiteEntity $site,
        $pageName,
        $pageType = PageTypes::NORMAL
    ) {
        $queryBuilder = $this->createQueryBuilder('page')
            ->leftJoin('page.publishedRevision', 'publishedRevision')
            ->leftJoin('publishedRevision.pluginWrappers', 'pluginWrappers')
            ->leftJoin('pluginWrappers.instance', 'pluginInstances')
            ->where('page.site = :site')
            ->andWhere('page.name = :pageName')
            ->andWhere('page.pageType = :pageType')
            ->setParameter('site', $site)
            ->setParameter('pageName', $pageName)
            ->setParameter('pageType', $pageType);

        return $queryBuilder->getQuery()->useQueryCache(true)->getResult();
    }
830758
public static function collect(string $className, $objectAnnotation = null, string $propertyName = '', string $methodName = '', $propertyValue = null)
    {
        // collect service
        if ($objectAnnotation instanceof Service) {

            $rc = new \ReflectionClass($className);
            $interfaces = $rc->getInterfaceNames();
            $methods = $rc->getMethods(\ReflectionMethod::IS_PUBLIC);
            $version = $objectAnnotation->getVersion();

            foreach ($interfaces as $interfaceClass){
                foreach ($methods as $method){
                    $methodName = $method->getName();
                    self::$serviceMapping[$interfaceClass][$version][$methodName] = [$className, $methodName];
                }
            }

            return;
        }
    }
979900
public function getFieldById(ContentTypeInterface $contentType, $fieldId)
    {
        $field = $this->om->getRepository($this->configurationManager->getEntityClass('field'))->find($fieldId);


        if (!$field instanceof FieldInterface) {
            return null;
        }
        if ($field->getContentType() && $field->getContentType()->getId() == $contentType->getId()) {
            return $field;
        }

        $parent = $field;
        while ($parent && $parentLayout = $parent->getLayout()) {
            if ($parent = $parentLayout->getParent()) {
                if ($parent->getContentType() !== null && $parent->getContentType()->getId() == $contentType->getId()) {
                    return $field;
                }
            }
        }

        return null;
    }
738298
public function getFieldByPropertyName(string $propertyName): ?FieldMetadataInterface
    {
        foreach ($this->fieldsMetadata as $fieldMetadata) {
            if ($propertyName === $fieldMetadata->getPropertyName()) {
                return $fieldMetadata;
            }
        }

        return null;
    }
1358442
private function proxyBean(string $name, string $className, $object)
    {
        if (!AspectCollector::hasClassname($className)) {
            return $object;
        }

        /* @var Aop $aop */
        $aop = App::getBean(Aop::class);

        $rc  = new \ReflectionClass($className);
        $rms = $rc->getMethods();
        foreach ($rms as $rm) {
            $method      = $rm->getName();
            $annotations = Collector::$methodAnnotations[$className][$method] ?? [];
            $annotations = array_unique($annotations);
            $aop->match($name, $className, $method, $annotations);
        }

        $handler = new AopHandler($object);

        return Proxy::newProxyInstance(\get_class($object), $handler);
    }
990818
private function getObjectId($fieldName, $objectName = "object")
    {
        //====================================================================//
        // Load Pointed Object
        $object = $this->{$objectName}->{ "get".$fieldName}();
        //====================================================================//
        // Check Pointed Object Exists & Has an Id
        if (!$object || !method_exists($object, "getId") || !$object->getId()) {
            return null;
        }
        //====================================================================//
        // Return Object Id
        return (string) $object->getId();
    }
1263521
public static function call($object, string $method, array $parameters)
    {
        $reflectionClass = new \ReflectionClass($object);
        $reflectionMethod = $reflectionClass->getMethod($method);
        $arguments = [];

        foreach ($reflectionMethod->getParameters() as $i => $reflectionParameter) {
            $argument = null;

            if (array_key_exists($reflectionParameter->name, $parameters) || array_key_exists($i, $parameters)) {
                $argument = $parameters[$reflectionParameter->name] ?? $parameters[$i] ?? null;
            } elseif ($reflectionParameter->isDefaultValueAvailable()) {
                $argument = $reflectionParameter->getDefaultValue();
            }

            if ($reflectionType = $reflectionParameter->getType()) {
                if ($reflectionType->isBuiltin()) {
                    if ($argument !== null || !$reflectionType->allowsNull()) {
                        settype($argument, $reflectionType->getName());
                    }
                } elseif ($argument === null && !$reflectionType->allowsNull()) {
                    return null;
                }
            }

            $arguments[] = $argument;
        }

        if ($reflectionMethod->isConstructor()) {
            return $reflectionClass->newInstanceArgs($arguments);
        }

        $reflectionMethod->setAccessible(true);

        return $reflectionMethod->invokeArgs($reflectionMethod->isStatic() ? null : $object, $arguments);
    }
807411
public function getUserTypeEntity($entityId, $fieldName) {
        /** @noinspection PhpDynamicAsStaticMethodCallInspection */
        $item = \CUserTypeEntity::GetList(array(), array(
            'ENTITY_ID' => $entityId,
            'FIELD_NAME' => $fieldName
        ))->Fetch();

        return (!empty($item)) ? $this->getUserTypeEntityById($item['ID']) : false;
    }