Skip to content

contact form backend - #247

Open
OStefan2001 wants to merge 6 commits into
developfrom
contact-form
Open

OStefan2001 wants to merge 6 commits into
developfrom
contact-form

Conversation

@OStefan2001

Copy link
Copy Markdown
Collaborator

Update $contactEmail from config/autoload/mail.global.php

@OStefan2001
OStefan2001 requested a review from bidi47 September 25, 2026 14:56
@codecov

codecov Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.34%. Comparing base (774eb82) to head (5cc0b94).
⚠️ Report is 7 commits behind head on develop.

Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #247      +/-   ##
=============================================
+ Coverage      60.58%   62.34%   +1.75%     
- Complexity       558      592      +34     
=============================================
  Files             91       95       +4     
  Lines           2187     2289     +102     
=============================================
+ Hits            1325     1427     +102     
  Misses           862      862              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@OStefan2001 OStefan2001 linked an issue Sep 25, 2026 that may be closed by this pull request
@arhimede

Copy link
Copy Markdown
Member

again factory ?
why not inject ?

@arhimede

Copy link
Copy Markdown
Member

@alexmerlin please confrim that the code is correct here , i feel that i am missing something

]));
}

return new RedirectResponse('/contact/?contact=sent#contact-form', 303);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You should not use hardcoded URLs.
Instead, generate the URL and pass it to RedirectResponse.

You can leave RedirectResponse with the default status 302 (Found) instead of using 303 (See other).
Or, if you need to set a different one, use status code constants from Fig\Http\Message\StatusCodeInterface.

Comment thread src/App/src/Service/ContactService.php Outdated
Comment on lines +38 to +43
public const array TOPICS = [
'migration' => 'Migration',
'project' => 'Project work',
'oss' => 'Open source',
'other' => 'Something else',
];

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To me, this calls for an ENUM.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since this handler serves all static pages, you do the contact_success etc for all those pages.
Why not created a dedicated handler to use for displaying the form?

@alexmerlin alexmerlin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would swap the two handler names:

  • src/App/src/Handler/GetContactCreateFormHandler.php -> src/App/src/Handler/GetCreateContactFormHandler.php
  • src/App/src/Handler/PostContactCreateHandler.php -> src/App/src/Handler/PostCreateContactHandler.php

So, it follows the general pattern we use across Dotkernel - see example.

['contact' => 'sent'],
'contact-form'
),
StatusCodeInterface::STATUS_SEE_OTHER

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As I said:

You can leave RedirectResponse with the default status 302 (Found) instead of using 303 (See other).

Any reason for keeping 303?

Comment thread src/App/src/Service/ContactService.php Outdated
Comment on lines +119 to +121
} catch (Throwable) {
return false;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't you log the error at this point?

Comment thread src/App/src/RoutesDelegator.php Outdated
Comment on lines +30 to +31
$app->get('/contact/', [GetContactCreateFormHandler::class], GetContactCreateFormHandler::TEMPLATE);
$app->post('/contact/', [PostContactCreateHandler::class], 'app::create-contact');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Since the two contact pages now have their own handlers, you should name the routes here individually.
See naming convention example in Dotkernel Admin:

  • for the route presenting the form, use app::create-contact-form (example)
  • for the route processing the form, use app::create-contact (example)

Also, this means removing contact from the static routes array in config/autoload/local.php.dist.

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.

extend contact us page

3 participants