diff --git a/Form/PersonType.php b/Form/PersonType.php index 868ffc85f..84b82cd23 100644 --- a/Form/PersonType.php +++ b/Form/PersonType.php @@ -42,7 +42,7 @@ class PersonType extends AbstractType ->add('dateOfBirth', 'date', array('required' => false, 'widget' => 'single_text', 'format' => 'dd-MM-yyyy')) ->add('placeOfBirth', 'text', array('required' => false)) ->add('genre', new GenderType(), array( - 'required' => false + 'required' => true )) ->add('memo', 'textarea', array('required' => false)) ->add('phonenumber', 'textarea', array('required' => false)) diff --git a/Form/Type/GenderType.php b/Form/Type/GenderType.php index 73ac65b9f..c3f348490 100644 --- a/Form/Type/GenderType.php +++ b/Form/Type/GenderType.php @@ -33,7 +33,7 @@ class GenderType extends AbstractType { 'choices' => $a, 'expanded' => true, 'multiple' => false, - 'empty_value' => 'Not given' + 'empty_value' => null )); } diff --git a/Resources/config/doctrine/Person.orm.yml b/Resources/config/doctrine/Person.orm.yml index 79bd43ce7..06cdd012e 100644 --- a/Resources/config/doctrine/Person.orm.yml +++ b/Resources/config/doctrine/Person.orm.yml @@ -1,6 +1,9 @@ Chill\PersonBundle\Entity\Person: type: entity table: null + indexes: + person_names: + columns: [firstName, lastName] repositoryClass: Chill\PersonBundle\Entity\PersonRepository fields: id: diff --git a/Search/PersonSearch.php b/Search/PersonSearch.php index 812fea242..b970e0462 100644 --- a/Search/PersonSearch.php +++ b/Search/PersonSearch.php @@ -99,7 +99,8 @@ class PersonSearch extends AbstractSearch $dql = 'SELECT p FROM ChillPersonBundle:Person p' . ' WHERE' . ' LOWER(p.firstName) like LOWER(:q)' - . ' OR LOWER(p.lastName) like LOWER(:q)'; + . ' OR LOWER(p.lastName) like LOWER(:q)' + . 'ORDER BY p.lastName, p.firstName'; $query = $this->om->createQuery($dql) ->setParameter('q', '%'.trim($pattern).'%') diff --git a/Tests/Fixtures/App/app/AppKernel.php b/Tests/Fixtures/App/app/AppKernel.php index 2e9b78c1f..6bb328454 100644 --- a/Tests/Fixtures/App/app/AppKernel.php +++ b/Tests/Fixtures/App/app/AppKernel.php @@ -15,6 +15,8 @@ class AppKernel extends Kernel new \Symfony\Bundle\AsseticBundle\AsseticBundle(), new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(), new Chill\PersonBundle\ChillPersonBundle(), + new Chill\MainBundle\ChillMainBundle(), + new \Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle, #add here all the required bundle (some bundle are not required) ); } diff --git a/composer.json b/composer.json index 338093410..2ce8008fe 100644 --- a/composer.json +++ b/composer.json @@ -28,11 +28,11 @@ "doctrine/common": "2.4.*@dev", "doctrine/doctrine-bundle": "~1.2@dev", "chill-project/main": "*@dev", - "chill-project/custom-fields": "*@dev" + "chill-project/custom-fields": "*@dev", + "doctrine/doctrine-fixtures-bundle": "~2.2" }, "require-dev": { "symfony/dom-crawler": "2.5", - "doctrine/doctrine-fixtures-bundle": "~2.2", "symfony/security": "~2.5" } }