コード例 #1
0
ファイル: AssetsService.php プロジェクト: kant312/sop
 /**
  * Returns all of the folders that are descendants of a given folder.
  *
  * @param AssetFolderModel $parentFolder
  *
  * @return array
  */
 public function getAllDescendantFolders(AssetFolderModel $parentFolder)
 {
     $query = craft()->db->createCommand()->select('f.*')->from('assetfolders AS f')->where(array('like', 'path', $parentFolder->path . '%'))->andWhere('sourceId = :sourceId', array(':sourceId' => $parentFolder->sourceId));
     $results = $query->queryAll();
     $descendantFolders = array();
     foreach ($results as $result) {
         $folder = AssetFolderModel::populateModel($result);
         $this->_foldersById[$folder->id] = $folder;
         $descendantFolders[$folder->id] = $folder;
     }
     return $descendantFolders;
 }
コード例 #2
0
 /**
  * Populates a folder model.
  *
  * @param array|AssetFolderRecord $attributes
  * @return AssetFolderModel
  */
 public function populateFolder($attributes)
 {
     $folder = AssetFolderModel::populateModel($attributes);
     return $folder;
 }