diff --git a/src/Bundle/ChillMainBundle/Controller/LocationController.php b/src/Bundle/ChillMainBundle/Controller/LocationController.php
index 75bc01262..e6aba8fc3 100644
--- a/src/Bundle/ChillMainBundle/Controller/LocationController.php
+++ b/src/Bundle/ChillMainBundle/Controller/LocationController.php
@@ -9,11 +9,17 @@ class LocationController extends CRUDController
{
public function customizeQuery(string $action, Request $request, $query): void
{
- $query->where('e.availableForUsers', "'TRUE'");
+ //$query->where('e.availableforusers', "'TRUE'"); // not working
+ $query->where('e.availableForUsers = true'); //TODO not working
}
- // public function createEntity(string $action, Request $request): object
- // {
-
- // }
-}
+
+ public function createEntity(string $action, Request $request): object
+ {
+ $entity = parent::createEntity($action, $request);
+
+ $entity->setAvailableForUsers(true);
+
+ return $entity;
+ }
+}
\ No newline at end of file
diff --git a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php
index 5574556f2..972c046d9 100644
--- a/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php
+++ b/src/Bundle/ChillMainBundle/DependencyInjection/ChillMainExtension.php
@@ -49,7 +49,7 @@ use Chill\MainBundle\Doctrine\Type\PointType;
use Chill\MainBundle\Entity\Location;
use Chill\MainBundle\Entity\LocationType;
use Chill\MainBundle\Form\LocationTypeType;
-use Chill\MainBundle\Form\LocationType as LocationFormType;
+use Chill\MainBundle\Form\LocationFormType;
use Symfony\Component\HttpFoundation\Request;
/**
diff --git a/src/Bundle/ChillMainBundle/Form/LocationType.php b/src/Bundle/ChillMainBundle/Form/LocationFormType.php
similarity index 66%
rename from src/Bundle/ChillMainBundle/Form/LocationType.php
rename to src/Bundle/ChillMainBundle/Form/LocationFormType.php
index 5bf71734c..b4811bad1 100644
--- a/src/Bundle/ChillMainBundle/Form/LocationType.php
+++ b/src/Bundle/ChillMainBundle/Form/LocationFormType.php
@@ -2,7 +2,6 @@
namespace Chill\MainBundle\Form;
-use Chill\MainBundle\Entity\Address;
use Chill\MainBundle\Entity\LocationType as EntityLocationType;
use Chill\MainBundle\Form\Type\PickAddressType;
use Chill\MainBundle\Templating\TranslatableStringHelper;
@@ -10,15 +9,18 @@ use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
+use Symfony\Component\OptionsResolver\OptionsResolver;
-final class LocationType extends AbstractType
+final class LocationFormType extends AbstractType
{
// private TranslatableStringHelper $translatableStringHelper;
- // public function __construct(
- // TranslatableStringHelper $translatableStringHelper
- // ) {
+ // /**
+ // * @param TranslatableStringHelper $translatableStringHelper
+ // */
+ // public function __construct(TranslatableStringHelper $translatableStringHelper)
+ // {
// $this->translatableStringHelper = $translatableStringHelper;
// }
@@ -33,7 +35,7 @@ final class LocationType extends AbstractType
->add('locationType', EntityType::class, [
'class' => EntityLocationType::class,
'choice_label' => function (EntityLocationType $entity) {
- //return $this->translatableStringHelper->localize($entity->getTitle());
+ //return $this->translatableStringHelper->localize($entity->getTitle()); //TODO not working. Cannot pass smthg in the constructor
return $entity->getTitle()['fr'];
},
])
@@ -44,4 +46,24 @@ final class LocationType extends AbstractType
'mapped' => false,
]);
}
+
+
+ /**
+ * @param OptionsResolverInterface $resolver
+ */
+ public function configureOptions(OptionsResolver $resolver)
+ {
+ $resolver->setDefaults(array(
+ 'data_class' => 'Chill\MainBundle\Entity\Location'
+ ));
+ }
+
+ /**
+ * @return string
+ */
+ public function getBlockPrefix()
+ {
+ return 'chill_mainbundle_location';
+ }
+
}
diff --git a/src/Bundle/ChillMainBundle/Resources/views/Location/index.html.twig b/src/Bundle/ChillMainBundle/Resources/views/Location/index.html.twig
index a99311a9c..37a520338 100644
--- a/src/Bundle/ChillMainBundle/Resources/views/Location/index.html.twig
+++ b/src/Bundle/ChillMainBundle/Resources/views/Location/index.html.twig
@@ -7,10 +7,10 @@
{{ 'Name'|trans }}
- {{ 'phonenumber1'|trans }}
- {{ 'phonenumber2'|trans }}
- {{ 'email'|trans }}
- {{ 'address'|trans }}
+ {{ 'Phonenumber1'|trans }}
+ {{ 'Phonenumber2'|trans }}
+ {{ 'Email'|trans }}
+ {{ 'Address'|trans }}