Get all locales in which this document currently exists in storage.
public getLocalesFor ( object $document ) : array | ||
$document | object | A managed document |
return | array | list of locales of this document |
/** * Get the list of locales that exist for the specified document, * including those not yet flushed, but bound * * @param $document the document to get the locales for * * @return array of strings with all locales existing for this particular document * * @throws PHPCRException if the document is not translatable */ public function getLocalesFor($document) { if (!is_object($document)) { throw new \InvalidArgumentException(gettype($document)); } $this->errorIfClosed(); return $this->unitOfWork->getLocalesFor($document); }
/** * {@inheritDoc} */ public function getLocalesFor($document, $includeFallbacks = false) { if (!is_object($document)) { throw new InvalidArgumentException('Parameter $document needs to be an object, ' . gettype($document) . ' given'); } $this->errorIfClosed(); $metadata = $this->getClassMetadata(get_class($document)); $locales = $this->unitOfWork->getLocalesFor($document); if ($includeFallbacks) { $fallBackLocales = array(); foreach ($locales as $locale) { $fallBackLocales = array_merge($fallBackLocales, $this->localeChooserStrategy->getFallbackLocales($document, $metadata, $locale)); } $locales = array_unique(array_merge($locales, $fallBackLocales)); } return $locales; }
/** * Get the list of locales that exist for the specified document, * including those not yet flushed, but bound * * @param $document the document to get the locales for * * @return array of strings with all locales existing for this particular document * * @throws PHPCRException if the document is not translatable */ public function getLocalesFor($document) { $this->errorIfClosed(); return $this->unitOfWork->getLocalesFor($document); }