Receive a count of all Product Images

@link   https://help.shopify.com/api/reference/product_image#count
@param  integer $productId
@param  array   $params
@return integer
345351
public function count($productId, array $params = array())
    {
        $endpoint = '/admin/products/'.$productId.'/images/count.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $response['count'];
    }
1325077
public function count($condition = [], $params = [])
    {
        return $this->db->count($this->name, $condition, $params);
    }
655966
public function count($params) {
        $orm = !is_null($params['ormObject']) ? $params['ormObject'] : ORM::for_table($params['table']);

        return $orm->count();
    }
1264541
public function getProductName($productId): ?string
    {
        $product = $this->productRepository->find($productId);
        if (!$product instanceof ProductInterface) {
            return null;
        }

        return $product->getName();
    }
402470
public function __async_getCount($materialFieldId)
    {
        // @var array $result Result of asynchronous controller
        $response = array('status' => 1);
        // Getting quantity from DB by param materialFieldId
        $response['count'] = $this->query
            ->entity(CMS::MATERIAL_IMAGES_RELATION_ENTITY)
            ->where(MaterialField::F_PRIMARY, $materialFieldId)
            ->count();

        return $response;
    }
654444
public function getSearchableProducts($storeId, $productIds = null, $fromId = 0, $limit = 1000)
    {
        $select = $this->getConnection()->select()
            ->from(['e' => $this->getTable('catalog_product_entity')]);

        $this->addIsVisibleInStoreFilter($select, $storeId);

        if ($productIds !== null) {
            $select->where('e.entity_id IN (?)', $productIds);
        }

        $select->limit($limit);
        $select->where('e.entity_id > ?', $fromId);
        $select->order('e.entity_id');

        return $this->connection->fetchAll($select);
    }
1191942
public function getProductRatingById($productId)
    {
        $this->validateProductId($productId);

        $queryBuilder = $this->queryBuilderFactory->create();
        $queryBuilder
            ->select([
                'OXID',
                'OXRATING',
                'OXRATINGCNT'
            ])
            ->from('oxarticles')
            ->where('oxid = :productId')
            ->setMaxResults(1)
            ->setParameter('productId', $productId);

        return $this->mapper->map(
            new ProductRating(),
            $queryBuilder->execute()->fetch()
        );
    }
748503
public function deleteImage($productId)
    {
        $productId = (int) $productId;

        if ($productId == 0 || $productId == '') {
            $message = 'Product ID not correct: ' . $productId;
            $this->log($message);
            die(json_encode([
                'status' => 0,
                'msg' => $message
            ]));
        }

        $product = $this->Product->find('all', [
            'conditions' => [
                'Products.id_product' => $productId
            ],
            'contain' => [
                'Images',
                'Manufacturers'
            ]
        ])->first();
        
        $this->Product->changeImage(
            [
                [$productId => 'no-image']
            ]
        );

        $actionLogMessage = __d('admin', 'Image_ID_{0}_from_manufacturer_{1}_was_deleted_successfully_Product_{1}_Manufacturer_{2}.', [
            $product->image->id_image,
            '<b>' . $product->name . '</b>',
            '<b>' . $product->manufacturer->name . '</b>'
        ]);

        $this->Flash->success($actionLogMessage);
        $this->ActionLog->customSave('product_image_deleted', $this->AppAuth->getUserId(), $productId, 'products', $actionLogMessage);

        $this->getRequest()->getSession()->write('highlightedRowId', $productId);

        $this->redirect($this->referer());
    }
1264680
public function postAction(Request $request, $productId)
    {
        $locale = $this->getLocale($request);
        $mediaId = $request->get('mediaId', '');

        try {
            $em = $this->getDoctrine()->getManager();
            /** @var Product $product */
            $product = $this->getProductManager()->findByIdAndLocale($productId, $locale);
            $media = $this->getMediaManager()->getById($mediaId, $locale);

            if (!$product) {
                throw new EntityNotFoundException($this->getProductEntityName(), $productId);
            }

            if (!$media) {
                throw new EntityNotFoundException($this->getMediaEntityName(), $mediaId);
            }

            if ($product->containsMedia($media)) {
                throw new RestException('Relation already exists');
            }

            //FIXME this is just a temporary solution
            // issue https://github.com/massiveart/POOL-ALPIN/issues/1467
            $this->removeDefaultPrices($product);
            $product->addMedia($media);
            $em->flush();

            $view = $this->view($media, 200);
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        } catch (RestException $exc) {
            $view = $this->view($exc->toArray(), 400);
        } catch (\Exception $e) {
            $view = $this->view($e->getMessage(), 400);
        }

        return $this->handleView($view);
    }
667164
public function create($productId, ProductImage &$productImage)
    {
        $data = $productImage->exportData();
        $endpoint = '/admin/products/'.$productId.'/images.json';
        $response = $this->request(
            $endpoint, 'POST', array(
            'image' => $data
            )
        );
        $productImage->setData($response['image']);
    }
609630
public function count(string $condition = '', array $params = array()) {
        $this->model->builder->select('COUNT(*)')
            ->from($this->model->tableName);
        if ($condition) {
            $this->model->builder->where($condition, $params);
        }
        $r = $this->model->builder->query();
        if (!is_array($r) || 0 === count($r)) {
            return false;
        }
        return (int) reset($r[0]);
    }
456087
public function getProductPageCount(int $pageSize = 100) : int
    {
        Assert::that($pageSize)->greaterThan(0, 'The $pageSize has to be positive');

        return (int)$this->master->doRequest(
            'GET',
            sprintf('/admin/WEBAPI/Endpoints/v1_0/ProductDataService/{KEY}/ProductPageCount/%d', $pageSize)
        );
    }
1362186
public function setProductTemplateAction($productId)
    {
        // Check current user authorization
        if (null !== $response = $this->checkAuth($this->resourceCode, array(), AccessManager::UPDATE)) {
            return $response;
        }

        $product = ProductQuery::create()->findPk($productId);

        if ($product != null) {
            $template_id = \intval($this->getRequest()->get('template_id', 0));

            $this->dispatch(
                TheliaEvents::PRODUCT_SET_TEMPLATE,
                new ProductSetTemplateEvent($product, $template_id, $this->getCurrentEditionCurrency()->getId())
            );
        }

        return $this->redirectToEditionTemplate();
    }
582669
public static function getSkusByProduct($productId, $filter = array())
    {
        $filter = Filter::create($filter);
        return self::getCollection('/products/'.$productId.'/skus' . $filter->toQuery(), 'Sku');
    }
248318
protected function getCategoryProductSelect($productIds, $storeId)
    {
        $select = $this->getConnection()->select()
            ->from(['cpi' => $this->getTable($this->getCategoryProductIndexTable($storeId))])
            ->where('cpi.store_id = ?', $storeId)
            ->where('cpi.product_id IN(?)', $productIds);

        return $select;
    }
269517
public function getAction(Request $request, $productId)
    {
        $locale = $request->get('locale');
        $product = $this->fetchProduct($productId);

        $content = $this->getProductContentMapper()->get($product, $locale);

        $view = $this->view($content, Response::HTTP_OK);

        return $this->handleView($view);
    }
906651
public static function count($condition, $params = array())
    {
        if (!is_a($condition, '\\mpf\\datasources\\sql\\ModelCondition')) {
            $condition = ModelCondition::getFrom($condition, get_called_class());
        }
        /* @var $condition ModelCondition */
        $condition->fields = 'COUNT(*) as number';
        $condition->setParams($params);
        $number = static::getDb()->queryAssoc($condition->__toString(true), $condition->getParams());
        return $number[0]['number'];
    }