Skip to content

Conversation

@KarlsonComplete
Copy link
Collaborator

.

@gemini-code-assist
Copy link

Summary of Changes

Hello @KarlsonComplete, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new 'Contact Persons' domain into the application, providing a structured and robust way to manage individual contact information. It establishes a comprehensive data model for contact persons, complete with lifecycle management (creation, updates, deletion, status changes, verification) and integrates it with the existing application installation logic. The changes are supported by new Doctrine mappings, dedicated repositories, and a set of well-defined use cases, ensuring maintainability and testability.

Highlights

  • New ContactPerson Entity: Introduces a new ContactPerson aggregate root with properties like ID, status, full name, email, mobile phone, comment, external ID, Bitrix24 user/partner IDs, and user agent information. This entity is designed for robust management of individual contact data.
  • Doctrine Integration: Provides comprehensive Doctrine XML mappings for the ContactPerson, FullName, and UserAgentInfo entities, along with a dedicated ContactPersonRepository for efficient data access and persistence. Custom Doctrine types for phone numbers and IP addresses are also registered.
  • Comprehensive Use Cases: Implements a suite of use cases for managing contact persons, including creation (Install), deletion (Uninstall), data modification (UpdateData), and verification of email and mobile phone numbers. Each use case is supported by dedicated commands and handlers.
  • New Dependencies: Integrates odolbeau/phone-number-bundle and darsyn/ip-doctrine to provide robust and standardized handling of phone numbers and IP addresses within the application, particularly for Doctrine entities. Additionally, symfony/var-exporter is added.
  • Extensive Testing: Includes a full suite of functional tests for the ContactPersonRepository and all new use case handlers, ensuring the reliability, correctness, and maintainability of the newly introduced contact persons feature.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@camaxtly camaxtly changed the base branch from add-contact-person-use-case to dev December 14, 2025 14:06
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a significant new feature, the "Contact Persons" use case, including entities, repositories, use cases, and tests. The overall structure is good and follows the existing architecture. However, I've found several issues related to correctness, consistency, and robustness that need to be addressed. These include potential null pointer exceptions, inconsistent behavior in entities, bugs in repositories and handlers, and some issues in the new tests. Please review the detailed comments below.

'contactPersonId' => $command->contactPersonId->toRfc4122(),
]);

/** @var null|AggregateRootEventsEmitterInterface|ContactPersonInterface $contactPerson */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Тут надо обрабатывать исключение, так как на момент верификации почты у тебя контактное лицо может быть уже удалено.

Copy link
Collaborator

Choose a reason for hiding this comment

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

У тебя контакное лицо связано с установкой

Copy link
Collaborator

Choose a reason for hiding this comment

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

Вопрос, что если почта уже подтверждена? =)))

Copy link
Collaborator

@camaxtly camaxtly left a comment

Choose a reason for hiding this comment

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

14-12-2025

'contactPersonId' => $command->contactPersonId->toRfc4122(),
]);

/** @var null|AggregateRootEventsEmitterInterface|ContactPersonInterface $contactPerson */
Copy link
Collaborator

Choose a reason for hiding this comment

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

У тебя контакное лицо связано с установкой

'contactPersonId' => $command->contactPersonId->toRfc4122(),
]);

/** @var null|AggregateRootEventsEmitterInterface|ContactPersonInterface $contactPerson */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Вопрос, что если почта уже подтверждена? =)))

Copy link
Collaborator

@camaxtly camaxtly left a comment

Choose a reason for hiding this comment

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

04-01-2026

public function unlinkContactPerson(): void
{
$this->updatedAt = new CarbonImmutable();
if (!$this->contactPersonId instanceof Uuid) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

is null для читаемости, а с ректором уже разбираемся отдельно

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

заменил но ректор показывает ошибку

public function unlinkBitrix24PartnerContactPerson(): void
{
$this->updatedAt = new CarbonImmutable();
if (!$this->bitrix24PartnerContactPersonId instanceof Uuid) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

is null

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

заменил но ректор показывает ошибку

Copy link
Collaborator

@camaxtly camaxtly left a comment

Choose a reason for hiding this comment

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

11-01-2026

…tion ID, handle exceptions, and improve logging
…s, streamline method calls, and update test implementations for consistency.
…` and `unlinkBitrix24PartnerContactPerson` methods.
$createdContactPersonId = '';

try {
if ($command->mobilePhoneNumber instanceof PhoneNumber) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Тут IF используется не корректно. Тебе надо проверить, а пришли ли данные для создания контактного лица, если пришли, то мы его создаем, если не пришли, то установка приложения проджолжается без контактного лица.

В ветке, когда создается контактное лицо можно использовать guard*, чтоб проверить входящие данные и если что-то не так, то мы прерываем работу этого хэндлера, но сам флоу установки должен пройти дальше.

$applicationInstallation = $this->applicationInstallationRepository->getById($command->applicationInstallationId);

$entitiesToFlush = [];
if ($contactPerson->isPartner()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

        if ($contactPerson->isPartner()) {
            $applicationInstallation->unlinkBitrix24PartnerContactPerson();
        } else  {
            $applicationInstallation->unlinkContactPerson();
        } 

          $this->applicationInstallationRepository->save($applicationInstallation);
          $entitiesToFlush[] = $applicationInstallation;

$contactPerson = $this->contactPersonRepository->getById($command->contactPersonId);

$actualEmail = $contactPerson->getEmail();
if (null == $actualEmail) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

избыточно, так как мы передаем в команду ту почту, которую верифицировали

$contactPerson = $this->contactPersonRepository->getById($command->contactPersonId);

$actualPhone = $contactPerson->getMobilePhone();
if (null == $actualPhone) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

избыточно

Copy link
Collaborator

@camaxtly camaxtly left a comment

Choose a reason for hiding this comment

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

18-01-2026

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.

2 participants