/** * Builds model from \Bitrix\Main\Entity\Result. * @param Result $result Query result. * @return static * @throws \Bitrix\Main\ArgumentException */ public static function buildFromResult(Result $result) { /** @var Storage $model */ $model = parent::buildFromResult($result); self::$loadedUsers[$model->getId()] = $model; return $model; }
public function __construct(Traversable $iterator, $classNameModel) { parent::__construct($iterator); $this->classNameModel = $classNameModel; if (!is_subclass_of($classNameModel, Internals\Model::className()) && !in_array(Internals\Model::className(), class_parents($classNameModel))) { throw new ObjectException("{$classNameModel} must be subclass of " . Internals\Model::className()); } }
protected function deleteInternal() { foreach ($this->getChildren() as $childSharing) { $childSharing->deleteInternal(); } unset($childSharing); return parent::deleteInternal(); }
/** * 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) { static::checkRequiredInputParams($data, array('OBJECT_ID', 'ENTITY_ID', 'ENTITY_TYPE', 'MODULE_ID')); $model = parent::add($data, $errorCollection); if ($model && $model->getCreatedBy()) { $driver = Driver::getInstance(); $driver->getRecentlyUsedManager()->push($model->getCreatedBy(), $model->getObjectId()); } return $model; }
/** * 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) { static::checkRequiredInputParams($data, array('OBJECT_ID', 'ENTITY_ID', 'ENTITY_TYPE', 'MODULE_ID')); return parent::add($data, $errorCollection); }
protected static function prepareGetListParameters(array $parameters) { if (isset($parameters['filter']['ENTITY_TYPE'])) { $parameters['filter']['=ENTITY_TYPE'] = $parameters['filter']['ENTITY_TYPE']; unset($parameters['filter']['ENTITY_TYPE']); } if (isset($parameters['filter']['ENTITY_ID'])) { $parameters['filter']['=ENTITY_ID'] = $parameters['filter']['ENTITY_ID']; unset($parameters['filter']['ENTITY_ID']); } if (isset($parameters['filter']['CODE'])) { $parameters['filter']['=CODE'] = $parameters['filter']['CODE']; unset($parameters['filter']['CODE']); } if (isset($parameters['filter']['XML_ID'])) { $parameters['filter']['=XML_ID'] = $parameters['filter']['XML_ID']; unset($parameters['filter']['XML_ID']); } if (isset($parameters['filter']['MODULE_ID'])) { $parameters['filter']['=MODULE_ID'] = $parameters['filter']['MODULE_ID']; unset($parameters['filter']['MODULE_ID']); } return parent::prepareGetListParameters($parameters); }
/** * Adds row to entity table, fills error collection and build 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) { static::checkRequiredInputParams($data, array('OBJECT_ID')); if (!empty($data['PASSWORD'])) { list($data['PASSWORD'], $data['SALT']) = ExternalLink::generatePasswordAndSalt($data['PASSWORD']); } $data['HASH'] = md5(uniqid($data['OBJECT_ID'], true) . \CMain::getServerUniqID()); return parent::add($data, $errorCollection); }
public function delete() { $success = parent::deleteInternal(); if (!$success) { return false; } \CFile::delete($this->fileId); return true; }