-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Demo] Init dashboard statistics #238
base: main
Are you sure you want to change the base?
Conversation
@@ -61,6 +63,14 @@ class Speaker implements ResourceInterface | |||
#[ORM\OneToOne(cascade: ['persist', 'remove'])] | |||
private ?SpeakerAvatar $avatar = null; | |||
|
|||
#[ORM\ManyToMany(targetEntity: Talk::class, mappedBy: 'speakers')] | |||
private Collection $talks; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't be there getters/setters for this collection?
@@ -26,4 +26,23 @@ public function __construct(ManagerRegistry $registry) | |||
{ | |||
parent::__construct($registry, Conference::class); | |||
} | |||
|
|||
public function findTotalConferences(\DatePeriod $datePeriod): int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A nitpick, would be cool to follow sylius/core-bundle notation as in example.
public function findTotalConferences(\DatePeriod $datePeriod): int | |
public function getTotalConferences(\DatePeriod $datePeriod): int |
$queryBuilder = $this->createQueryBuilder('o'); | ||
|
||
$queryBuilder | ||
->select('COUNT(o.id)') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$queryBuilder = $this->createQueryBuilder('o'); | |
$queryBuilder | |
->select('COUNT(o.id)') | |
return (int) $this->createQueryBuilder('o') | |
->select('COUNT(o.id)') |
$queryBuilder->expr()->gte('o.startsAt', ':start_date'), | ||
) | ||
->andWhere( | ||
$queryBuilder->expr()->lt('o.startsAt', ':end_date'), | ||
) | ||
->setParameter('start_date', $datePeriod->getStartDate()) | ||
->setParameter('end_date', $datePeriod->getEndDate()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's more common within sylius to use camelCase for parameters.
$queryBuilder->expr()->gte('o.startsAt', ':start_date'), | |
) | |
->andWhere( | |
$queryBuilder->expr()->lt('o.startsAt', ':end_date'), | |
) | |
->setParameter('start_date', $datePeriod->getStartDate()) | |
->setParameter('end_date', $datePeriod->getEndDate()) | |
$queryBuilder->expr()->gte('o.startsAt', ':startDate'), | |
) | |
->andWhere( | |
$queryBuilder->expr()->lt('o.startsAt', ':endDate'), | |
) | |
->setParameter('startDate', $datePeriod->getStartDate()) | |
->setParameter('endDate', $datePeriod->getEndDate()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comments for other repository methods.
return $queryBuilder->getQuery()->getResult(); | ||
} | ||
|
||
public function findTotalTalks(\DatePeriod $datePeriod): int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
--- findTotalTalks
+++ findTotalSpeakers
public function findTotalTalks(\DatePeriod $datePeriod): int | |
public function getTotalSpeakers(\DatePeriod $datePeriod): int |
public function findTotalTalks(\DatePeriod $datePeriod): int | |
public function getTotalSpeakersWithTalksInPeriod(\DatePeriod $datePeriod): int |
return $queryBuilder->getQuery()->getResult(); | ||
} | ||
|
||
public function findTotalTalks(\DatePeriod $datePeriod): int |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public function findTotalTalks(\DatePeriod $datePeriod): int | |
public function getTotalTalks(\DatePeriod $datePeriod): int |
day: Jour | ||
lifetime: Durée de vie | ||
month: Mois | ||
week: Semaine | ||
2weeks: 2 Semaines | ||
year: Année |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is english translation file, please translate 😄
Based on #237
dashboard_statistics_demo.webm