/** * 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) { $folder = parent::add($data, $errorCollection); if ($folder) { Driver::getInstance()->sendChangeStatusToSubscribers($folder); } return $folder; }
/** * 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) { /** @var Folder $folder */ $folder = parent::add($data, $errorCollection); if ($folder) { $driver = Driver::getInstance(); $driver->getIndexManager()->indexFolder($folder); $driver->sendChangeStatusToSubscribers($folder); } return $folder; }
/** * 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) { $parent = null; if (isset($data['PARENT']) && $data['PARENT'] instanceof Folder) { $parent = $data['PARENT']; unset($data['PARENT']); } $file = parent::add($data, $errorCollection); if ($file) { if ($parent !== null) { $file->setAttributes(array('PARENT' => $parent)); } $versionData = array('ID' => $file->getFileId(), 'FILE_SIZE' => $file->getSize()); if (!empty($data['UPDATE_TIME'])) { $versionData['UPDATE_TIME'] = $data['UPDATE_TIME']; } $file->addVersion($versionData, $file->getCreatedBy()); } return $file; }