getList() public static method

Returns the documents list instance.
public static getList ( array $config = [] ) : Listing
$config array
return Pimcore\Model\Document\Listing
Exemplo n.º 1
0
 /**
  * @param null $condition
  * @param null $order
  * @param null $orderKey
  * @param null $offset
  * @param null $limit
  * @param null $groupBy
  * @throws \Exception
  */
 public function getDocumentList($condition = null, $order = null, $orderKey = null, $offset = null, $limit = null, $groupBy = null)
 {
     try {
         $list = Document::getList(array("condition" => $condition, "order" => $order, "orderKey" => $orderKey, "offset" => $offset, "limit" => $limit, "groupBy" => $groupBy));
         $list->setUnpublished(1);
         $items = array();
         /** @var  $doc Document */
         foreach ($list as $doc) {
             $item = new Webservice\Data\Document\Listing\Item();
             $item->id = $doc->getId();
             $item->type = $doc->getType();
             if (method_exists($doc, "getPublished")) {
                 $item->published = $doc->getPublished();
             }
             $items[] = $item;
         }
         return $items;
     } catch (\Exception $e) {
         \Logger::error($e);
         throw $e;
     }
 }
Exemplo n.º 2
0
 public function portletModifiedDocumentsAction()
 {
     $list = Document::getList(["limit" => 10, "order" => "DESC", "orderKey" => "modificationDate"]);
     $response = [];
     $response["documents"] = [];
     foreach ($list as $doc) {
         $response["documents"][] = ["id" => $doc->getId(), "type" => $doc->getType(), "path" => $doc->getRealFullPath(), "date" => $doc->getModificationDate(), "condition" => "userModification = '" . $this->getUser()->getId() . "'"];
     }
     $this->_helper->json($response);
 }