예제 #1
0
 /**
  * Upload a NDA to the system and store it for the user
  *
  * @param array   $file
  * @param Contact $contact
  * @param Call    $call
  *
  * @return NdaObject
  */
 public function uploadNda(array $file, Contact $contact, Call $call = null)
 {
     $ndaObject = new NdaObject();
     $ndaObject->setObject(file_get_contents($file['tmp_name']));
     $nda = new Nda();
     $nda->setContact($contact);
     if (!is_null($call)) {
         $nda->setCall([$call]);
     }
     $nda->setSize($file['size']);
     $contentType = $this->getGeneralService()->findContentTypeByContentTypeName($file['type']);
     if (is_null($contentType)) {
         $contentType = $this->getGeneralService()->findEntityById('ContentType', 0);
     }
     $nda->setContentType($contentType);
     $ndaObject->setNda($nda);
     $this->newEntity($ndaObject);
     return $ndaObject->getNda();
 }