/** * {@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; }