Skip to content
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

openchurch v2 #32

Open
wants to merge 136 commits into
base: develop
Choose a base branch
from
Open

openchurch v2 #32

wants to merge 136 commits into from

Conversation

bailletced
Copy link
Collaborator

No description provided.

@bailletced bailletced requested a review from quentin-st March 3, 2025 09:59
Copy link
Contributor

@quentin-st quentin-st left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO only the security.yaml (firewall rule) is blocking

I get the domain driven development hype, but

  • it makes code analysis and review sincerily painful
  • induces code duplication
  • is reaaaaally verbose, without bringing much more clarity

I don't get the excessive use of interfaces, they don't bring anything to the table IMHO. Some classes and methods only serve as direct aliases to Doctrine EntityManager or querybuilders methods calls, which are a bad pattern.
Some behaviors (such as repositories cloning) might become dangerous and come and bite our fingers someday.

I appreciate the extensive tests!

# Note: Only the *first* access control that matches will be used
access_control:
# - { path: ^/admin, roles: ROLE_ADMIN }
# - { path: ^/, roles: ROLE_USER }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not blocking) No access control rules are defined: what happens if someone tries to call a CRUD endpoint without API key? Shouldn't we define PUT/POST endpoints as rules in here?

@@ -0,0 +1,767 @@
#!/usr/bin/env python3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not blocking) Shouldn't we remove this script?

'progress' => key_exists('currentBatch', $churchData) ? ceil(($churchData['currentBatch'] / $churchData['batchCount']) * 100) : 'undefined',
'startDate' => key_exists('startDate', $churchData) ? (new \DateTime($churchData['startDate']))->format('Y-m-d H:i:s') : 'undefined',
'endDate' => key_exists('endDate', $churchData) ? (new \DateTime($churchData['endDate']))->format('Y-m-d H:i:s') : 'undefined',
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not blocking) Too much code duplication, please refactor

private readonly PlaceRepositoryInterface $placeRepository,
private readonly FieldRepositoryInterface $fieldRepo,
private ValidatorInterface $validator,
private Security $security,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not blocking) Please set all injected services as readonly when possible

throw new ValidationException($violations);
}

$field->applyValue(); // Dynamycally set the value to the correct property (intVal, stringVal, ...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not blocking) Dynamycally

foreach ($entity->fields as $field) {
call_user_func($detachCallback, $field);
}
call_user_func($detachCallback, $entity);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not blocking) These call_user_func to call EntityManager::detach are far from elegant, and induce complexity: it hides this service dependency to the EntityManager
Just inject EntityManagerInterface in this service and call its detach function

if ($e instanceof ValidationException) {
return $e->getMessage();
}
if ($e instanceof ProblemExceptionInterface) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not blocking) This class does not extend Exception: is this dead code?

call_user_func($detachCallback, $entity);

if ($e instanceof ValidationException) {
return $e->getMessage();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not blocking) This if branch isn't useful, since it's the same as the default (last return of the function)


if (null !== $paginator = $models->paginator()) {
$resources = new Paginator(
new \ArrayIterator($resources),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(not blocking) Please always use imports instead of \Class usages (please fix across project)

"minimum-stability": "stable",
"prefer-stable": true,
"require": {
"php": ">=8.2",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants