Skip to content

Commit

Permalink
Merge pull request #2 from vm5/insights
Browse files Browse the repository at this point in the history
Fix insights
  • Loading branch information
Warxcell authored Aug 24, 2018
2 parents c2c0cf5 + 13af283 commit 8ad4fdd
Show file tree
Hide file tree
Showing 17 changed files with 49 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/.idea
/vendor
composer.lock
composer.lock
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ env:
- SYMFONY_VERSION="3.4.*"

install:
- composer require symfony/symfony:${SYMFONY_VERSION}
- composer require symfony/symfony:${SYMFONY_VERSION}
6 changes: 1 addition & 5 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ class Configuration implements ConfigurationInterface
public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('vm5_entity_translations');

// Here you should define the parameters that are allowed to
// configure your bundle. See the documentation linked above for
// more information on that topic.
$treeBuilder->root('vm5_entity_translations');

return $treeBuilder;
}
Expand Down
7 changes: 2 additions & 5 deletions DependencyInjection/VM5EntityTranslationsExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace VM5\EntityTranslationsBundle\DependencyInjection;

use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;

/**
* This is the class that loads and manages your bundle configuration.
Expand All @@ -19,9 +19,6 @@ class VM5EntityTranslationsExtension extends Extension
*/
public function load(array $configs, ContainerBuilder $container)
{
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);

$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');
}
Expand Down
2 changes: 1 addition & 1 deletion EventSubscriber/LocaleListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ public function onKernelRequest(GetResponseEvent $event)
{
$this->guessLoader->load();
}
}
}
4 changes: 0 additions & 4 deletions Form/EventListener/ResizeFormListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use Symfony\Component\Form\FormInterface;
use VM5\EntityTranslationsBundle\Model\EditableTranslation;
use VM5\EntityTranslationsBundle\Model\Language;
use VM5\EntityTranslationsBundle\Model\Translatable;
use VM5\EntityTranslationsBundle\Model\Translation;

class ResizeFormListener implements EventSubscriberInterface
Expand Down Expand Up @@ -154,9 +153,6 @@ public function submit(FormEvent $event)
/** @var EditableTranslation[] $translations */
$translations = $event->getData();

/** @var Translatable $translatable */
$translatable = $event->getForm()->getParent()->getData();

$forDelete = [];
foreach ($this->languages as $language) {
$translation = $translations[$language->getLocale()];
Expand Down
2 changes: 1 addition & 1 deletion Form/Type/TranslationsType.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,4 @@ public function configureOptions(OptionsResolver $resolver)

$resolver->setDefaults($options);
}
}
}
2 changes: 1 addition & 1 deletion Guesser/Guesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ public function guessLocale();
* @return string[]|null
*/
public function guessFallbackLocales();
}
}
2 changes: 1 addition & 1 deletion Guesser/GuesserLoader.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ public function load()
}
}
}
}
}
2 changes: 1 addition & 1 deletion Guesser/SymfonyTranslationGuesser.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ public function guessFallbackLocales()

return null;
}
}
}
2 changes: 1 addition & 1 deletion Model/EditableTranslation.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ interface EditableTranslation extends Translation
* @return void
*/
public function setLanguage(Language $language);
}
}
2 changes: 1 addition & 1 deletion Model/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ interface Language
* @return string
*/
public function getLocale();
}
}
2 changes: 1 addition & 1 deletion Resources/views/bootstrap_3_tab_layout.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@
{{ form_widget(child) }}
{{ form_errors(child) }}
</div>
{% endblock %}
{% endblock %}
2 changes: 1 addition & 1 deletion Translator.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,4 @@ private function getId(Translatable $translatable)
{
return spl_object_hash($translatable);
}
}
}
2 changes: 1 addition & 1 deletion Twig/Extension/TranslationExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ public function translate(Translatable $translatable, $field, $locale = null)
{
return $this->translator->translate($translatable, $field, $locale);
}
}
}
65 changes: 33 additions & 32 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
{
"name": "vm5/entity-translations-bundle",
"description": "This bundle provides translations for entities in your project. It's a bundle, but can be used standalone.",
"type": "symfony-bundle",
"authors": [
{
"name": "Bozhidar Hristov",
"email": "[email protected]"
"name": "vm5/entity-translations-bundle",
"license": "MIT",
"description": "This bundle provides translations for entities in your project. It's a bundle, but can be used standalone.",
"type": "symfony-bundle",
"authors": [
{
"name": "Bozhidar Hristov",
"email": "[email protected]"
}
],
"keywords": [
"translation"
],
"require-dev": {
"phpunit/phpunit": "^5.7",
"symfony/symfony": "~2.8 | ~3.0",
"doctrine/orm": "~2.5.0",
"doctrine/doctrine-bundle": "~1.8"
},
"suggest": {
"doctrine/orm": "Autoload translations with Doctrine ORM",
"symfony/symfony": "Needed for easy integration into Symfony",
"twig/twig": "Needed to use Twig Extension to translate in twig.",
"symfony/property-access": "Needed for Twig extension to translate",
"symfony/translation": "Needed if you want to use Symfony Translation's configuration. Otherwise this bundle should be setup separately.",
"symfony/form": "Needed if you want to use forms to translate entities.",
"doctrine/doctrine-bundle": "Needed if you want to use forms to translate entities."
},
"autoload": {
"psr-4": {
"VM5\\EntityTranslationsBundle\\": ""
}
}
],
"keywords": [
"translation"
],
"require-dev": {
"phpunit/phpunit": "^5.7",
"symfony/symfony": "~2.8 | ~3.0",
"doctrine/orm": "~2.5.0",
"doctrine/doctrine-bundle": "~1.8"
},
"suggest": {
"doctrine/orm": "Autoload translations with Doctrine ORM",
"symfony/symfony": "Needed for easy integration into Symfony",
"twig/twig": "Needed to use Twig Extension to translate in twig.",
"symfony/property-access": "Needed for Twig extension to translate",
"symfony/translation": "Needed if you want to use Symfony Translation's configuration. Otherwise this bundle should be setup separately.",
"symfony/form": "Needed if you want to use forms to translate entities.",
"doctrine/doctrine-bundle": "Needed if you want to use forms to translate entities."
},
"autoload": {
"psr-4": {
"VM5\\EntityTranslationsBundle\\": ""
}
}
}
}
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@
</exclude>
</whitelist>
</filter>
</phpunit>
</phpunit>

0 comments on commit 8ad4fdd

Please sign in to comment.