예제 #1
0
 public function setPKs($entity, $pk)
 {
     $props = $this->entityConfig->getPkProperties();
     foreach ($props as $prop) {
         $this->set($entity, $prop->getName(), $pk[$prop->getName()]);
     }
     return $this;
 }
 /**
  * Saves the one to one relationships for an entity
  * @param object $obj entity to save one to one relationship for
  */
 function saveOneToOne($obj, OutletEntityConfig $entityCfg)
 {
     foreach ($entityCfg->getAssociations() as $assoc) {
         if ($assoc->getType() != 'one-to-one') {
             // only process 'one-to-one' relationships
             continue;
         }
         $key = $assoc->getKey();
         $refKey = $assoc->getRefKey();
         $getter = $assoc->getGetter();
         $ent = $obj->{$getter}();
         if ($ent) {
             if (self::isNew($ent)) {
                 $this->save($ent);
             }
             $obj->{$key} = $ent->{$refKey};
         }
     }
 }
예제 #3
0
 /**
  * Gets the upper most class name
  * @return string
  */
 function getSuperClass()
 {
     if ($this->isSubclass) {
         return $this->superConfig->getClass();
     }
     return $this->getClass();
 }