Neos\Media\Domain\Service\AssetService::getUsageCount PHP Method

getUsageCount() public method

Returns the total count of times an asset is used.
public getUsageCount ( Neos\Media\Domain\Model\AssetInterface $asset ) : integer
$asset Neos\Media\Domain\Model\AssetInterface
return integer
    public function getUsageCount(AssetInterface $asset)
    {
        $usageCount = 0;
        /** @var AssetUsageStrategyInterface $strategy */
        foreach ($this->getUsageStrategies() as $strategy) {
            $usageCount += $strategy->getUsageCount($asset);
        }
        return $usageCount;
    }

Usage Example

コード例 #1
0
 /**
  * Returns the number of times the asset is in use.
  *
  * @return integer
  * @api
  */
 public function getUsageCount()
 {
     return $this->assetService->getUsageCount($this);
 }