Neos\Media\Domain\Service\AssetService::getUsageCount PHP Метод

getUsageCount() публичный Метод

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
Результат 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);
 }