예제 #1
0
 /**
  * @param TblPerson $tblPersonFrom
  * @param TblPerson $tblPersonTo
  * @param TblType   $tblType
  * @param string    $Remark
  *
  * @return TblToPerson
  */
 public function addPersonRelationshipToPerson(TblPerson $tblPersonFrom, TblPerson $tblPersonTo, TblType $tblType, $Remark)
 {
     $Manager = $this->Connection->getEntityManager();
     $Entity = new TblToPerson();
     $Entity->setServiceTblPersonFrom($tblPersonFrom);
     $Entity->setServiceTblPersonTo($tblPersonTo);
     $Entity->setTblType($tblType);
     $Entity->setRemark($Remark);
     $Manager->saveEntity($Entity);
     Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity);
     return $Entity;
 }
예제 #2
0
 /**
  * @param TblPerson $tblPersonFrom
  * @param TblPerson $tblPersonTo
  * @param TblType   $tblType
  * @param string    $Remark
  *
  * @return TblToPerson
  */
 public function addPersonRelationshipToPerson(TblPerson $tblPersonFrom, TblPerson $tblPersonTo, TblType $tblType, $Remark)
 {
     $Manager = $this->Connection->getEntityManager();
     $Entity = $Manager->getEntity('TblToPerson')->findOneBy(array(TblToPerson::SERVICE_TBL_PERSON_FROM => $tblPersonFrom->getId(), TblToPerson::SERVICE_TBL_PERSON_TO => $tblPersonTo->getId(), TblToPerson::ATT_TBL_TYPE => $tblType->getId()));
     if (null === $Entity) {
         $Entity = new TblToPerson();
         $Entity->setServiceTblPersonFrom($tblPersonFrom);
         $Entity->setServiceTblPersonTo($tblPersonTo);
         $Entity->setTblType($tblType);
         $Entity->setRemark($Remark);
         $Manager->saveEntity($Entity);
         Protocol::useService()->createInsertEntry($this->Connection->getDatabase(), $Entity);
     }
     return $Entity;
 }