Ejemplo n.º 1
0
 public static function getPropertiesAndValues($instance, $props = NULL)
 {
     $ret = array();
     $className = get_class($instance);
     if (is_null($props)) {
         $props = Reflexion::getProperties($instance);
     }
     foreach ($props as $prop) {
         $prop->setAccessible(true);
         $v = $prop->getValue($instance);
         if (OrmUtils::isSerializable($className, $prop->getName())) {
             if ($v !== null && $v !== "" || ($v === null || $v === "") && OrmUtils::isNullable($className, $prop->getName())) {
                 $name = OrmUtils::getFieldName($className, $prop->getName());
                 $ret[$name] = $v;
             }
         }
     }
     return $ret;
 }
Ejemplo n.º 2
0
 public static function getJoinColumn($class, $member)
 {
     $annot = Reflexion::getAnnotationMember($class, $member, "JoinColumn");
     if ($annot == false) {
         $annot = new \JoinColumn();
         $annot->name = "id" . ucfirst(OrmUtils::getTableName(ucfirst($member)));
     }
     return $annot;
 }