21 public static function getMethods($instance, $filter =
null) {
22 $reflect = new \ReflectionClass ($instance);
23 return $reflect->getMethods($filter);
32 $prop->setAccessible(
true);
33 return $prop->getValue($instance);
37 return $prop->getValue($instance);
43 $prop->setAccessible(
true);
44 $prop->setValue($instance, $value);
52 $className = \get_class($instance);
54 if (isset (self::$classProperties [$className])) {
55 foreach (self::$classProperties [$className] as $name => $prop) {
56 $ret [$name] = $prop->getValue($instance);
60 if (\is_null($props)) {
61 $props = self::getProperties($instance);
63 foreach ($props as $prop) {
64 $prop->setAccessible(
true);
65 $v = $prop->getValue($instance);
67 $name = $modelMetas [
'#fieldNames'] [$prop->getName()] ?? $prop->getName();
69 self::$classProperties [$className] [$name] = $prop;
82 return CacheManager::getAnnotationsEngineInstance();
86 return self::getAnnotsEngine()->getAnnotsOfClass($class, $annotation);
90 $annot = self::getAnnotsEngine()->getAnnotsOfProperty($class, $member, $annotation);
91 return \current($annot);
95 $annot = self::getAnnotsEngine()->getAnnotsOfMethod($class, $method, $annotation);
96 return \current($annot);
100 return self::getAnnotsEngine()->getAnnotsOfProperty($class, $member, $annotation);
104 $annotsEngine = self::getAnnotsEngine();
105 if (\is_array($annotation)) {
107 foreach ($annotation as $annot) {
108 $annots = $annotsEngine->getAnnotsOfMethod($class, $method, $annot);
109 if (\count($annots) > 0) {
110 $result = \array_merge($result, $annots);
115 $annots = $annotsEngine->getAnnotsOfMethod($class, $method, $annotation);
116 if (\count($annots) > 0) {
123 return self::getMembersWithAnnotation_($class, $annotation,
function (&$ret, $prop, $annot) {
124 $ret [$prop->getName()] = $annot;
129 return self::getMembersWithAnnotation_($class, $annotation,
function (&$ret, $prop) {
135 return self::getMembersWithAnnotation_($class, $annotation,
function (&$ret, $prop) {
136 $ret [] = $prop->getName();
141 $props = self::getProperties($class);
143 foreach ($props as $prop) {
144 $annot = self::getAnnotationMember($class, $prop->getName(), $annotation);
145 if ($annot !==
false) {
146 $callback ($ret, $prop, $annot);
153 $ret = self::getAnnotationClass($class,
'table');
154 if (\count($ret) === 0) {
155 $posSlash = \strrpos($class,
'\\');
156 if ($posSlash !==
false) {
157 $class = \substr($class, $posSlash + 1);
161 $ret = $ret [0]->name;
168 foreach ($method->getParameters() as $param) {
169 $result [] = $param->name;
176 $annots = self::getMembersAnnotationWithAnnotation($class,
'joinTable');
177 foreach ($annots as $annot) {
178 $result [] = $annot->name;
185 foreach ($models as $model) {
186 $result = \array_merge($result, self::getJoinTables($model));
Manager for caches (Router, Rest, models).
Object/relational mapping utilities.
static isNotNullOrNullAccepted($v, $className, $member)
static getModelMetadata($className)
static getProperty($instance, $member)
Reflection utilities in dev environment only.
static getMembersAnnotationWithAnnotation($class, $annotation)
static getAnnotationClass($class, $annotation)
static getPropValue($instance, $prop)
static getJoinTables($class)
static setMemberValue($instance, $member, $value)
static getTableName($class)
static getAnnotsEngine()
Returns the annotation engine (php8 attributes or php annotations).
static getKeyFields($instance)
static getAnnotationMethod($class, $method, $annotation)
static getPropertiesAndValues($instance, $props=null)
static getMemberValue($instance, $member)
static getMethods($instance, $filter=null)
static getMethodParameters(\ReflectionFunctionAbstract $method)
static getMembersWithAnnotation($class, $annotation)
static getAllJoinTables($models)
static getAnnotationsMember($class, $member, $annotation)
static getAnnotationMember($class, $member, $annotation)
static getMembersNameWithAnnotation($class, $annotation)
static getAnnotationsMethod($class, $method, $annotation)
static getMembersWithAnnotation_($class, $annotation, $callback)
Ubiquity\annotations$AnnotationsInterface This class is part of Ubiquity.