Detect searchable fields and searchable relations.
Falls back to {@link DataObject->summaryFields()} if
no custom search fields are defined.

@param string $dataClass The class name
@return array|null names of the searchable fields
966192
public function scaffoldSearchFields($dataClass)
    {
        $obj = DataObject::singleton($dataClass);
        $fields = null;
        if ($fieldSpecs = $obj->searchableFields()) {
            $customSearchableFields = $obj->config()->get('searchable_fields');
            foreach ($fieldSpecs as $name => $spec) {
                if (is_array($spec) && array_key_exists('filter', $spec)) {
                    // The searchableFields() spec defaults to PartialMatch,
                    // so we need to check the original setting.
                    // If the field is defined $searchable_fields = array('MyField'),
                    // then default to StartsWith filter, which makes more sense in this context.
                    if (!$customSearchableFields || array_search($name, $customSearchableFields)) {
                        $filter = 'StartsWith';
                    } else {
                        $filter = preg_replace('/Filter$/', '', $spec['filter']);
                    }
                    $fields[] = "{$name}:{$filter}";
                } else {
                    $fields[] = $name;
                }
            }
        }
        if (is_null($fields)) {
            if ($obj->hasDatabaseField('Title')) {
                $fields = array('Title');
            } elseif ($obj->hasDatabaseField('Name')) {
                $fields = array('Name');
            }
        }

        return $fields;
    }
597379
public function fetchAllObj(string $class = null): array
    {
        if ($class == null && $this->modelClass !== null) {
            return parent::fetchAllObj($this->modelClass);
        } else {
            return parent::fetchAllObj($class);
        }
    }
34321
public function extractInheritableQueryParameters(DataQuery $query)
    {
        $params = $query->getQueryParams();

        // Remove `Foreign.` query parameters for created objects,
        // as this would interfere with relations on those objects.
        foreach (array_keys($params) as $key) {
            if (stripos($key, 'Foreign.') === 0) {
                unset($params[$key]);
            }
        }

        // Get inheritable parameters from an instance of the base query dataclass
        $inst = Injector::inst()->create($query->dataClass());
        $inst->setSourceQueryParams($params);
        return $inst->getInheritableQueryParams();
    }
532087
private function getPropertyMap($class)
    {
        $output['meta'] = $meta = $this->em->getClassMetadata($class);
        $output['fields']       = $meta->getFieldNames();
        $output['associations'] = $meta->getAssociationNames();

        $output['fields'] = array_filter(
            $output['fields'],
            function($fieldName) use ($output) {
                if (in_array($fieldName, $output['associations'])) {
                    return false;
                } else {
                    return true;
                }
            }
        );

        return $output;
    }
514267
public function getIdentifiers($class)
    {
        $schema = $this->getSchema($class);

        if (isset($schema->claroline)) {
            return $schema->claroline->ids;
        }

        return [];
    }
485195
public static function parseRelationClass($class)
    {
        // detect many many through syntax
        if (is_array($class)
            && array_key_exists('through', $class)
            && array_key_exists('to', $class)
        ) {
            $toRelation = $class['to'];

            $hasOne = Config::inst()->get($class['through'], 'has_one');
            if (empty($hasOne) || !is_array($hasOne) || !array_key_exists($toRelation, $hasOne)) {
                return $class;
            }

            return $hasOne[$toRelation];
        }

        return $class;
    }
254537
public function getEditableFieldsWithValues($params = null,$class = 'HpsPayPlanSchedule'){
        if ($params===null){
            $params=$this;
        }
        return parent::getEditableFieldsWithValues($class, $params);
    }
696664
public function getAnnotationsFromPropertyOrClass($annotation_class)
	{
		$annotations = $this->getAnnotations($annotation_class);

		if ( !$annotations ) {
			$annotations = $this->annotationManager->getClassAnnotations($this->getDataType(), $annotation_class);
		}

		return $annotations;
	}
1175887
private function fetchFields($subClass)
    {
        $fields = [];
        foreach ($this->fields as $name => $field) {
            if ($field instanceof $subClass) {
                $fields[$name] = $field;
            }
        }

        return $fields;
    }
688798
protected function getModelClassForResource($resourceClass)
    {
        if (false === array_key_exists($resourceClass, $this->getModelClasses())) {
            throw new \InvalidArgumentException(sprintf('"%s" class not supported', $resourceClass));
        }

        return $this->getModelClasses()[$resourceClass];
    }
550422
public function getConstructorFields($gClass) {
    if (!isset($this->constructorFields)) {
      $this->constructorFields = array();
      
      if ($gClass->hasMethod('__construct')) {
        foreach ($gClass->getMethod('__construct')->getParameters() as $parameter) {
          $this->constructorFields[] = $parameter->getName();
        }
      }
    }
    
    return $this->constructorFields;
  }
138599
public function getImplements(string $class){
        if(!class_exists($class)){
            throw new \InvalidArgumentException();
        }

        if(false === ($parent = get_parent_class($class))){
            return array_values(array_unique(class_implements($class)));
        }

        return array_values(
            array_unique(
                array_diff(
                    class_implements($class),
                    class_implements($parent)
                )
            )
        );
    }
263994
private function findRelations(string $class, array $relations): array
    {
        $results = [];

        foreach ($relations as $relation) {
            $definition = $relation->getDefinition();
            if ($definition->sourceContext()->getClass() === $class) {
                $name = $definition->getName();
                $types = [];

                $relationType = $definition->getType();
                if (in_array($relationType, [RecordEntity::MANY_TO_MANY, RecordEntity::HAS_MANY])) {
                    $types[] = $definition->getTarget() . '[]';
                } else {
                    $types[] = $definition->getTarget();
                }

                $types[] = $this->relationsConfig->relationClass($relationType,
                    RelationsConfig::ACCESS_CLASS);

                $options = $definition->getOptions();
                if (array_key_exists(RecordEntity::NULLABLE, $options)
                    && true === $options[RecordEntity::NULLABLE]
                ) {
                    $types[] = 'null';
                }

                $results[$name] = $types;
            }
        }

        return $results;
    }
539814
public function getAttributeKeys($class = null) {
		foreach($this as $key => $data) {
			if($class) {
				if($data instanceof $class)
					$ret[] = $key;
			} else {
				$ret[] = $key;
			}
		}
		return $ret;
	}
1125506
public static function getIdsWithInheritance($klass)
    {
        $klasses = Common::getClassLineage($klass);

        $result = array();
        foreach ($klasses as $klass) {
            try {
                $result[] = $klass::getViewDataTableId();
            } catch (\Exception $e) {
                // in case $klass did not define an id: eg Plugin\ViewDataTable
                continue;
            }
        }

        return $result;
    }
983559
public function parseClass($class)
    {
        $reflectionClass = new ReflectionClass($class);

        // check if class is entity
        if ($this->reader->getClassAnnotation($reflectionClass, '\ProAI\Datamapper\Annotations\Entity')) {
            return $this->parseEntity($class);
        } else {
            return null;
        }
    }
916214
private function getEntityTypeInfo($class)
    {
        $entityType = $this->getEntityType($class);

        if (!$entityType) {
            return [null, null];
        }

        $info = entity_get_info($entityType);

        if (!$info) {
            return [null, null];
        }

        return [$entityType, $info];
    }