Skip to content

Урфу, ртф#9

Open
Temburdakov927 wants to merge 1 commit intoartsofte-php-course:mainfrom
Temburdakov927:main
Open

Урфу, ртф#9
Temburdakov927 wants to merge 1 commit intoartsofte-php-course:mainfrom
Temburdakov927:main

Conversation

@Temburdakov927
Copy link

No description provided.

Artem Burdakov
}
$this->denyAccessUnlessGranted('complete', $task);

if($task->isCompleted())

Choose a reason for hiding this comment

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

Лучше вынести в метод сущности, например, $task->toggleComplete()
$this->complete = $this->complete ? false : true;

}
}

public function getAvailableProject(int $id, Bool $hasAdmin = false): array

Choose a reason for hiding this comment

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

Лучше вместо $id использовать $authorId


foreach ($filter as $key => $value)
{
if($key === null)

Choose a reason for hiding this comment

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

Тут вероятно должно быть if($name === null)

])
->add("due_date", ChoiceType::class, [
'choices' => [
'Newest' => true,

Choose a reason for hiding this comment

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

Лучше сделать asc/desc/null

public function getAvaiableTaskWithFilter(int $id, array $filter, Bool $hasAdmin = false): array
{

if($filter['due_date'] or $filter['due_date'] === null)

Choose a reason for hiding this comment

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

Как-то так должно быть кажется.

$sorting = ['due_date' => 'asc'];
if(isset($filter['due_date'] && in_array($filter['due_date'], ['asc', 'desc']) {
$sorting = [
'due_date' => $filter['due_date'];
];
}

}
else
{
$this->id = $id;

Choose a reason for hiding this comment

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

Удалить, ниже использование $this->id заменить на $id

}
else
{
$this->id = $id;

Choose a reason for hiding this comment

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

Аналогично методу ::getAvailableProjects


class TaskType extends AbstractType
{
private $hasAdmin;

Choose a reason for hiding this comment

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

Нет необходимости использовать свойства.

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