/** * Preload AttachedObjects in blog posts. * @param array $blogPostIds List of blog post id. * @return void */ public function loadBatchAttachedObjectInBlogPost(array $blogPostIds) { if (empty($blogPostIds)) { return; } list($connectorClass, $moduleId) = $this->getConnectorDataByEntityType('BLOG_POST'); /** @var \Bitrix\Disk\AttachedObject $attachedObject */ foreach (AttachedObject::getModelList(array("filter" => array('=ENTITY_TYPE' => $connectorClass, 'ENTITY_ID' => $blogPostIds, '=MODULE_ID' => $moduleId), 'with' => array('OBJECT'))) as $attachedObject) { $this->loadedAttachedObjects[$attachedObject->getId()] = $attachedObject; } unset($attachedObject); }
/** * Returns all attached objects by the file. * @param array $parameters Parameters. * @return AttachedObject[] */ public function getAttachedObjects(array $parameters = array()) { if (!isset($parameters['filter'])) { $parameters['filter'] = array(); } $parameters['filter']['OBJECT_ID'] = $this->id; $parameters['filter']['=VERSION_ID'] = null; return AttachedObject::getModelList($parameters); }