alphabetical order for selectboxes (#510)
This commit is contained in:
@@ -70,8 +70,8 @@ class ActivityEditForm extends AbstractType
|
||||
->add('project', ProjectType::class, [
|
||||
'label' => 'label.project',
|
||||
'required' => false,
|
||||
'query_builder' => function (ProjectRepository $repo) use ($project) {
|
||||
return $repo->builderForEntityType($project);
|
||||
'query_builder' => function (ProjectRepository $repo) use ($project, $customer) {
|
||||
return $repo->builderForEntityType($project, $customer);
|
||||
},
|
||||
])
|
||||
->add('fixedRate', NumberType::class, [
|
||||
|
||||
@@ -69,6 +69,7 @@ abstract class AbstractToolbarForm extends AbstractType
|
||||
$query = new CustomerQuery();
|
||||
$query->setVisibility(CustomerQuery::SHOW_BOTH); // this field is the reason for the query here
|
||||
$query->setResultType(CustomerQuery::RESULT_TYPE_QUERYBUILDER);
|
||||
$query->setOrderBy('name');
|
||||
|
||||
return $repo->findByQuery($query);
|
||||
},
|
||||
@@ -162,6 +163,7 @@ abstract class AbstractToolbarForm extends AbstractType
|
||||
$query->setCustomer($data['customer']);
|
||||
$query->setResultType(ProjectQuery::RESULT_TYPE_QUERYBUILDER);
|
||||
$query->setVisibility(ProjectQuery::SHOW_BOTH);
|
||||
$query->setOrderBy('name');
|
||||
|
||||
return $repo->findByQuery($query);
|
||||
},
|
||||
@@ -176,7 +178,6 @@ abstract class AbstractToolbarForm extends AbstractType
|
||||
protected function addActivityChoice(FormBuilderInterface $builder)
|
||||
{
|
||||
$builder->add('activity', ActivityType::class, [
|
||||
'group_by' => null,
|
||||
'required' => false,
|
||||
'query_builder' => function (ActivityRepository $repo) {
|
||||
$query = new ActivityQuery();
|
||||
@@ -184,6 +185,7 @@ abstract class AbstractToolbarForm extends AbstractType
|
||||
$query->setGlobalsOnly(true);
|
||||
$query->setOrderGlobalsFirst(true);
|
||||
$query->setVisibility(ActivityQuery::SHOW_BOTH);
|
||||
$query->setOrderBy('name');
|
||||
|
||||
return $repo->findByQuery($query);
|
||||
},
|
||||
@@ -198,7 +200,6 @@ abstract class AbstractToolbarForm extends AbstractType
|
||||
}
|
||||
|
||||
$event->getForm()->add('activity', ActivityType::class, [
|
||||
'group_by' => null,
|
||||
'required' => false,
|
||||
'query_builder' => function (ActivityRepository $repo) use ($data) {
|
||||
$query = new ActivityQuery();
|
||||
@@ -206,6 +207,7 @@ abstract class AbstractToolbarForm extends AbstractType
|
||||
$query->setProject($data['project']);
|
||||
$query->setOrderGlobalsFirst(true);
|
||||
$query->setVisibility(ActivityQuery::SHOW_BOTH);
|
||||
$query->setOrderBy('name');
|
||||
|
||||
return $repo->findByQuery($query);
|
||||
},
|
||||
|
||||
@@ -142,8 +142,13 @@ class ActivityRepository extends AbstractRepository
|
||||
$qb->select('a', 'p', 'c')
|
||||
->from(Activity::class, 'a')
|
||||
->leftJoin('a.project', 'p')
|
||||
->leftJoin('p.customer', 'c')
|
||||
->orderBy('a.' . $query->getOrderBy(), $query->getOrder());
|
||||
->leftJoin('p.customer', 'c');
|
||||
|
||||
if ($query->isOrderGlobalsFirst()) {
|
||||
$qb->orderBy('a.project', 'ASC');
|
||||
}
|
||||
|
||||
$qb->addOrderBy('a.' . $query->getOrderBy(), $query->getOrder());
|
||||
|
||||
$where = $qb->expr()->andX();
|
||||
|
||||
@@ -202,10 +207,6 @@ class ActivityRepository extends AbstractRepository
|
||||
$qb->setParameter('activity', $entity);
|
||||
}
|
||||
|
||||
if ($query->isOrderGlobalsFirst()) {
|
||||
$qb->orderBy('a.project', 'ASC');
|
||||
}
|
||||
|
||||
if ($or->count() > 0) {
|
||||
$qb->andWhere($or);
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ class CustomerRepository extends AbstractRepository
|
||||
$query = new CustomerQuery();
|
||||
$query->setHiddenEntity($entity);
|
||||
$query->setResultType(CustomerQuery::RESULT_TYPE_QUERYBUILDER);
|
||||
$query->setOrderBy('name');
|
||||
|
||||
return $this->findByQuery($query);
|
||||
}
|
||||
|
||||
@@ -95,6 +95,7 @@ class ProjectRepository extends AbstractRepository
|
||||
$query->setHiddenEntity($entity);
|
||||
$query->setCustomer($customer);
|
||||
$query->setResultType(ProjectQuery::RESULT_TYPE_QUERYBUILDER);
|
||||
$query->setOrderBy('name');
|
||||
|
||||
return $this->findByQuery($query);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user