FOF30\Utils\ModelTypeHints::getRawHints PHP Метод

getRawHints() публичный Метод

Return the raw hints array
public getRawHints ( ) : array
Результат array
    public function getRawHints()
    {
        $model = $this->model;
        $hints = array('property' => array(), 'method' => array(), 'property-read' => array());
        $hasFilters = $model->getBehavioursDispatcher()->hasObserverClass('FOF30\\Model\\DataModel\\Behaviour\\Filters');
        $magicFields = array('enabled', 'ordering', 'created_on', 'created_by', 'modified_on', 'modified_by', 'locked_on', 'locked_by');
        foreach ($model->getTableFields() as $fieldName => $fieldMeta) {
            $fieldType = $this->getFieldType($fieldMeta->Type);
            if (!in_array($fieldName, $magicFields)) {
                $hints['property'][] = array($fieldType, '$' . $fieldName);
            }
            if ($hasFilters) {
                $hints['method'][] = array('$this', $fieldName . '()', $fieldName . '(' . $fieldType . ' $v)');
            }
        }
        $relations = $model->getRelations()->getRelationNames();
        $modelType = get_class($model);
        $modelTypeParts = explode('\\', $modelType);
        array_pop($modelTypeParts);
        $modelType = implode('\\', $modelTypeParts) . '\\';
        if ($relations) {
            foreach ($relations as $relationName) {
                $relationObject = $model->getRelations()->getRelation($relationName)->getForeignModel();
                $relationType = get_class($relationObject);
                $relationType = str_replace($modelType, '', $relationType);
                $hints['property-read'][] = array($relationType, '$' . $relationName);
            }
        }
        return $hints;
    }