Minor - fix entities, remove unused code

pull/3924/head
Julio Montoya 5 years ago
parent 7a0fedc972
commit a725682c83
  1. 8
      public/main/inc/lib/usermanager.lib.php
  2. 43
      src/CoreBundle/Entity/GradebookResultAttempt.php
  3. 2
      src/CourseBundle/Entity/CStudentPublication.php
  4. 1
      tests/CoreBundle/Api/UserRelUserRepositoryTest.php

@ -4594,15 +4594,11 @@ class UserManager
$result = Database::query($sql);
$num = Database::num_rows($result);
if (0 === $num) {
/*$date = api_get_utc_datetime();
$sql = "INSERT INTO $userRelUserTable (user_id, friend_user_id, relation_type, last_edit)
VALUES ($subscribedUserId, $userId, $relationType, '$date')";
$result = Database::query($sql);
$affectedRows += Database::affected_rows($result);*/
$userRelUser = (new UserRelUser())
->setUser(api_get_user_entity($subscribedUserId))
->setFriend(api_get_user_entity($userId))
->setRelationType($relationType);
->setRelationType($relationType)
;
$em = Database::getManager();
$em->persist($userRelUser);
$em->flush();

@ -29,7 +29,7 @@ class GradebookResultAttempt
/**
* @ORM\Column(name="comment", type="text", nullable=true)
*/
protected ?bool $comment = null;
protected ?string $comment = null;
/**
* @ORM\Column(name="score", type="float", nullable=true)
@ -41,4 +41,45 @@ class GradebookResultAttempt
* @ORM\JoinColumn(name="result_id", referencedColumnName="id", onDelete="CASCADE")
*/
protected GradebookResult $result;
public function getId(): int
{
return $this->id;
}
public function getComment(): ?string
{
return $this->comment;
}
public function setComment(?string $comment): self
{
$this->comment = $comment;
return $this;
}
public function getScore(): ?float
{
return $this->score;
}
public function setScore(?float $score): self
{
$this->score = $score;
return $this;
}
public function getResult(): GradebookResult
{
return $this->result;
}
public function setResult(GradebookResult $result): self
{
$this->result = $result;
return $this;
}
}

@ -172,7 +172,7 @@ class CStudentPublication extends AbstractResource implements ResourceInterface
public function __toString(): string
{
return (string) $this->getTitle();
return $this->getTitle();
}
/**

@ -29,7 +29,6 @@ class UserRelUserRepositoryTest extends AbstractApiTest
$em = self::getContainer()->get('doctrine')->getManager();
$userRepo = self::getContainer()->get(UserRepository::class);
$userRelUserRepo = $em->getRepository(UserRelUser::class);
$tokenTest = $this->getUserToken(
[

Loading…
Cancel
Save