Example #1
0
 /**
  * Adds row to entity table, fills error collection and builds model.
  * @param array           $data Data.
  * @param ErrorCollection $errorCollection Error collection.
  * @return \Bitrix\Disk\Internals\Model|static|null
  * @throws \Bitrix\Main\NotImplementedException
  * @internal
  */
 public static function add(array $data, ErrorCollection $errorCollection)
 {
     $result = FileTable::add($data);
     if (!$result->isSuccess()) {
         $errorCollection->addFromResult($result);
         return null;
     }
     $file = static::buildFromResult($result);
     return $file;
 }
Example #2
0
 /**
  * Adds row to entity table, fills error collection and builds model.
  * @param array           $data Data.
  * @param ErrorCollection $errorCollection Error collection.
  * @return \Bitrix\Disk\Internals\Model|static|null
  * @throws \Bitrix\Main\NotImplementedException
  * @internal
  */
 public static function add(array $data, ErrorCollection $errorCollection)
 {
     $result = FileTable::add($data);
     if (!$result->isSuccess()) {
         $errorCollection->addFromResult($result);
         return null;
     }
     $file = static::buildFromResult($result);
     if ($file && $file->getCreatedBy()) {
         $driver = Driver::getInstance();
         $driver->getRecentlyUsedManager()->push($file->getCreatedBy(), $file->getId());
     }
     return $file;
 }