protected function saveInternal(EmailTemplate $entity, array $data)
    {
        if ($entity->getIsNewRecord() && !$entity->load($data)) {
            throw new \DomainException('Cannot load data to primary model');
        }

        foreach ($data[EmailTemplateTranslation::internalFormName()] as $language => $dataSet) {
            $translationEntity = $entity->getTranslation($language);

            foreach ($dataSet as $attribute => $translation) {
                $translationEntity->$attribute = $translation;
            }
        }

        if (!$entity->save()) {
            throw new \RuntimeException();
        }
    }
protected function saveInternal(EmailTemplate $entity, array $data)
    {
        if ($entity->getIsNewRecord() && !$entity->load($data)) {
            throw new \DomainException('Cannot load data to primary model');
        }

        foreach ($data[EmailTemplateTranslation::internalFormName()] as $language => $dataSet) {
            $translationEntity = $entity->getTranslation($language);

            foreach ($dataSet as $attribute => $translation) {
                $translationEntity->$attribute = $translation;
            }
        }

        if (!$entity->save()) {
            throw new \RuntimeException();
        }
    }
protected function saveInternal ( EmailTemplate $ entity , array $ data ) { if ( $ entity -> getIsNewRecord ( ) && ! $ entity -> load ( $ data ) ) { throw new \ DomainException ( 'Cannot load data to primary model' ) ; } foreach ( $ data [ EmailTemplateTranslation :: internalFormName ( ) ] as $ language => $ dataSet ) { $ translationEntity = $ entity -> getTranslation ( $ language ) ; foreach ( $ dataSet as $ attribute => $ translation ) { $ translationEntity -> $ attribute = $ translation ; } } if ( ! $ entity -> save ( ) ) { throw new \ RuntimeException ( ) ; } }
Save entity to database.

@param EmailTemplate $entity
@param array $data

@throws \DomainException
@throws \RuntimeException
Save entity to database .