Skip to content

Commit

Permalink
Bump php + auditor
Browse files Browse the repository at this point in the history
  • Loading branch information
a-menshchikov committed Jun 13, 2024
1 parent 4c86160 commit b320054
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ jobs:
echo "::endgroup::"
- name: Auditor
uses: docker://nbgrp/auditor:0.20.0
uses: docker://nbgrp/auditor:0.26.0
with:
working-directory: shared/homeless
4 changes: 2 additions & 2 deletions docker/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.3.2-fpm-alpine
FROM php:8.3.8-fpm-alpine

#
# Setup Moscow time
Expand Down Expand Up @@ -36,7 +36,7 @@ RUN apk update \
nodejs \
yarn \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer \
&& composer self-update 2.5.1 \
&& composer self-update 2.7.1 \
&& docker-php-ext-install \
bcmath \
gd \
Expand Down
2 changes: 1 addition & 1 deletion docker/local/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.3.2-fpm-alpine
FROM php:8.3.8-fpm-alpine

USER root

Expand Down
16 changes: 11 additions & 5 deletions shared/homeless/src/Admin/ClientAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,12 @@ public function configureShowFields(ShowMapper $show): void
}

$field = $fieldValue->getField();
$fieldCode = $field->getCode();

$options = ['label' => $field->getName()];
$options = [
'label' => $field->getName(),
'accessor' => static fn (Client $client): mixed => $client->getAdditionalFieldValue($fieldCode),
];

switch ($field->getType()) {
case ClientField::TYPE_OPTION:
Expand All @@ -242,12 +246,12 @@ public function configureShowFields(ShowMapper $show): void
break;
}

if ($field->getCode() === 'homelessFrom') {
if ($fieldCode === 'homelessFrom') {
$options['pattern'] = 'MMM y';
}

$showMapperAdditionalInfo[\count($showMapperAdditionalInfo) - 1]['add'] = [
self::getAdditionalFieldName($field->getCode()),
self::getAdditionalFieldName($fieldCode),
$field->getShowFieldType(),
$options,
];
Expand All @@ -262,8 +266,7 @@ public function configureShowFields(ShowMapper $show): void
foreach ($showMapperAdditionalInfoSort as $showMapperAdditionalInfoSortItems) {
foreach ($showMapperAdditionalInfoSortItems as $item) {
if (isset($item['add'])) {
$reflectionMethod = new \ReflectionMethod(ShowMapper::class, 'add');
$reflectionMethod->invokeArgs($show, $item['add']);
$show->add(...$item['add']);
}
}
}
Expand Down Expand Up @@ -545,6 +548,8 @@ protected function configureFormFields(FormMapper $form): void
'label' => 'Не бездомный',
'label_attr' => ['class' => 'changeSelectinsData'],
'required' => false,
'getter' => static fn (Client $client): bool => !$client->isHomeless(),
'setter' => static fn (Client $client, bool $value): Client => $client->setIsHomeless(!$value),
])
;
}
Expand Down Expand Up @@ -676,6 +681,7 @@ protected function configureListFields(ListMapper $list): void
->add('lastContractDuration', null, [
'template' => '/admin/fields/client_contract_duration_list.html.twig',
'label' => ' ',
'virtual_field' => true,
])
->addIdentifier('id', 'number', [
'route' => ['name' => 'show'],
Expand Down
26 changes: 0 additions & 26 deletions shared/homeless/src/Entity/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,20 +154,6 @@ public function __toString(): string
return $this->getFullname();
}

public function __call($name, $args): mixed
{
$property = lcfirst(substr($name, 3));
if (str_starts_with($name, 'get') && str_starts_with($property, 'additionalField')) {
return $this->getAdditionalFieldValue(substr($property, 15));
}

if (str_starts_with($name, 'set') && str_starts_with($property, 'additionalField')) {
$this->setAdditionalFieldValue(substr($name, 15), \count($args) === 1 ? $args[0] : null);
}

return null;
}

public function getPhoto(): ?File
{
return $this->photo;
Expand Down Expand Up @@ -623,18 +609,6 @@ public function setIsHomeless(bool $isHomeless): self
return $this;
}

public function notIsHomeless(): bool
{
return !$this->isHomeless;
}

public function setNotIsHomeless(bool $notIsHomeless): self
{
$this->isHomeless = !$notIsHomeless;

return $this;
}

public function getClientViews(): Collection
{
return $this->clientViews;
Expand Down

0 comments on commit b320054

Please sign in to comment.