Sulu\Bundle\ResourceBundle\Api\Operator::getTranslation PHP Метод

getTranslation() приватный Метод

Get translation by locale.
private getTranslation ( ) : OperatorTranslation
Результат Sulu\Bundle\ResourceBundle\Entity\OperatorTranslation
    private function getTranslation()
    {
        $operatorTranslation = null;
        foreach ($this->entity->getTranslations() as $translation) {
            if ($translation->getLocale() == $this->locale) {
                $operatorTranslation = $translation;
            }
        }
        if (!$operatorTranslation) {
            $operatorTranslation = new OperatorTranslation();
            $operatorTranslation->setLocale($this->locale);
            $operatorTranslation->setOperator($this->entity);
            $this->entity->addTranslation($operatorTranslation);
        }
        return $operatorTranslation;
    }