25 if ($fieldTypes !==
false) {
33 if (isset ( $types [$field] )) {
34 return $types [$field];
46 if (! \is_string ( $instance )) {
47 $instance = \get_class ( $instance );
59 if (! \is_string ( $instance )) {
60 $instance = \get_class ( $instance );
62 if($info=self::getAnnotationInfo ( $instance,
'#primaryKeys' )){
63 return \array_keys ( $info );
72 return \current ( $kf );
83 if (isset ( self::$propFirstKeys [$class] )) {
84 return self::$propFirstKeys [$class];
86 $prop = new \ReflectionProperty ( $class, \array_key_first ( self::getAnnotationInfo ( $class,
'#primaryKeys' ) ) );
87 $prop->setAccessible (
true );
88 return self::$propFirstKeys [$class] = $prop;
92 if (isset ( self::$propKeys [$class] )) {
93 return self::$propKeys [$class];
97 foreach ( $pkMembers as $member => $_field ) {
98 $prop = new \ReflectionProperty ( $class, $member );
99 $prop->setAccessible (
true );
102 return self::$propKeys [$class] = $result;
106 if (isset ( self::$accessors [$class] )) {
107 return self::$accessors [$class];
110 foreach ( $members as $member => $field ) {
111 $accesseur =
'set' . \ucfirst ( $member );
112 if (! isset ( $result [$field] ) && method_exists ( $class, $accesseur )) {
113 $result [$field] = $accesseur;
116 return self::$accessors [$class] = $result;
120 return \array_keys ( self::getAnnotationInfo ( $class,
'#fieldNames' ) );
124 if (isset ( self::$fieldNames [$model] )) {
125 return self::$fieldNames [$model];
130 foreach ( $fields as $member => $field ) {
131 if (\array_search ( $member, $serializables ) !==
false)
132 $result [$field] = $member;
134 return self::$fieldNames [$model] = $result;
139 $fieldNames = \array_values ( self::getAnnotationInfo ( $class,
'#fieldNames' ) );
140 return \array_diff (
$fieldNames, $notSerializable );
149 $memberNames = \array_keys ( self::getAnnotationInfo ( $class,
'#fieldNames' ) );
150 return \array_diff ( $memberNames, $notSerializable );
155 if ($manyToOne = self::getAnnotationInfo ( $class,
'#manyToOne' )) {
156 foreach ( $manyToOne as $member ) {
158 $result [] = $joinColumn [
'name'];
161 if ($manyToMany = self::getAnnotationInfo ( $class,
'#manyToMany' )) {
162 $manyToMany = \array_keys ( $manyToMany );
163 foreach ( $manyToMany as $member ) {
164 $result [] = $member .
'Ids';
Ubiquity\orm\traits$OrmUtilsFieldsTrait This class is part of Ubiquity.
static getAnnotationInfo($class, $keyAnnotation)
static getFieldTypes($className)
static getSerializableMembers($class)
static getSerializableFields($class)
static getKeyFields($instance)
Return primary key fields from instance or model class.
static getPropKeys($class)
static getFieldType($className, $field)
static getFirstPropKey($class)
static getFirstKey($class)
static getKeyMembers($instance)
Return primary key members from instance or model class.
static getNullableFields($class)
static getAccessors($class, $members)
static getFormAllFields($class)
static getFieldNames($model)
static getAllFields($class)
static getAnnotationInfoMember($class, $keyAnnotation, $member)
Ubiquity\orm\traits This class is part of Ubiquity.