GetList() public static method

Returns an article images list based on the given parameters.
public static GetList ( array $p_parameters, array $p_order = [], integer $p_start, integer $p_limit, integer &$p_count, $p_skipCache = false ) : array
$p_parameters array An array of ComparisonOperation objects
$p_order array An array of columns and directions to order by
$p_start integer The record number to start the list
$p_limit integer The offset. How many records from $p_start will be retrieved.
$p_count integer The total count of the elements; this count is computed without applying the start ($p_start) and limit parameters ($p_limit)
return array $articleImagesList An array of Image objects
コード例 #1
0
	/**
	 * Creates the list of objects. Sets the parameter $p_hasNextElements to
	 * true if this list is limited and elements still exist in the original
	 * list (from which this was truncated) after the last element of this
	 * list.
	 *
	 * @param int $p_start
	 * @param int $p_limit
	 * @param array $p_parameters
	 * @param int &$p_count
	 * @return array
	 */
	protected function CreateList($p_start = 0, $p_limit = 0, array $p_parameters, &$p_count)
	{
	    $articleImagesList = ArticleImage::GetList($this->m_constraints, $this->m_order, $p_start, $p_limit, $p_count);
	    $metaImagesList = array();
	    foreach ($articleImagesList as $image) {
	        $metaImagesList[] = new MetaImage($image->getImageId());
	    }
	    return $metaImagesList;
	}
コード例 #2
0
 /**
  * Creates the list of objects. Sets the parameter $p_hasNextElements to
  * true if this list is limited and elements still exist in the original
  * list (from which this was truncated) after the last element of this
  * list.
  *
  * @param int $p_start
  * @param int $p_limit
  * @param array $p_parameters
  * @param int &$p_count
  * @return array
  */
 protected function CreateList($p_start = 0, $p_limit = 0, array $p_parameters, &$p_count)
 {
     $cacheService = \Zend_Registry::get('container')->getService('newscoop.cache');
     $cacheKey = $cacheService->getCacheKey(array('ArticleImagesList', implode('-', $this->m_constraints), implode('-', $this->m_order), $p_start, $p_limit, implode('-', $p_parameters), $p_count), 'article_image');
     if ($cacheService->contains($cacheKey)) {
         $metaImagesList = $cacheService->fetch($cacheKey);
     } else {
         $articleImagesList = ArticleImage::GetList($this->m_constraints, $this->m_order, $p_start, $p_limit, $p_count);
         $metaImagesList = array();
         foreach ($articleImagesList as $image) {
             $metaImagesList[] = new MetaImage($image->getImageId());
         }
         $cacheService->save($cacheKey, $metaImagesList);
     }
     return $metaImagesList;
 }
コード例 #3
0
    public function testGetListBadParameter()
    {
        global $g_ado_db;

        // builds the constraint
        $leftOperand = 'ArticleImages.Number';
        $rightOperand = 2;
        $operator = new Operator('is', 'sql');
        $comparisonOperationObj = new ComparisonOperation($leftOperand,
                                                          $operator,
                                                          $rightOperand);

        // sets the params for ArticleImage::GetList()
        $params = array($comparisonOperationObj);
        $order = array();
        $limitStart = 0;
        $limitOffset = 5;

        $this->assertEquals(null, ArticleImage::GetList($params, $order, $limitStart, $limitOffset));
    } // fn testGetListBadParameter