Skip to content

Commit

Permalink
Rename Rooms => Room
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jul 19, 2023
1 parent 6d5469a commit 1b059a7
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 34 deletions.
8 changes: 4 additions & 4 deletions application/src/Controller/BackOfficeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use App\Entity\Medias;
use App\Entity\Password;
use App\Entity\RoomMember;
use App\Entity\Rooms;
use App\Entity\Room;
use App\Entity\Threepids;
use App\Entity\Tokens;
use App\Entity\Users;
Expand Down Expand Up @@ -103,7 +103,7 @@ public function backOfficeReset(string $serverID) : JsonResponse
{
$entities = [
Users::class,
Rooms::class,
Room::class,
Medias::class
];

Expand All @@ -128,7 +128,7 @@ public function backOfficeReset(string $serverID) : JsonResponse
public function getAllRooms(string $serverID): JSONResponse
{
$rooms = $this->getDoctrine()
->getRepository(Rooms::class)
->getRepository(Room::class)
->findBy(['serverid' => $serverID]);

$responsedata = (object) [
Expand Down Expand Up @@ -223,7 +223,7 @@ public function setData(
$host,
);

$room = new Rooms();
$room = new Room();
$room->setRoomid($roomID);
$room->setName($roomName);
$room->setTopic($roomdata->topic ?? null);
Expand Down
12 changes: 6 additions & 6 deletions application/src/Controller/MatrixController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Controller;

use App\Entity\Password;
use App\Entity\Rooms;
use App\Entity\Room;
use App\Entity\RoomMember;
use App\Entity\Tokens;
use App\Entity\Users;
Expand Down Expand Up @@ -245,7 +245,7 @@ public function createRoom(string $serverID, Request $request):JsonResponse {

// Store the room in the DB.
$entityManager = $this->getDoctrine()->getManager();
$room = new Rooms();
$room = new Room();

$room->setRoomid($roomID);
$room->setName($roomName);
Expand All @@ -254,7 +254,7 @@ public function createRoom(string $serverID, Request $request):JsonResponse {
$room->setCreator($accessCheck['user_id']);
if (isset($payload->room_alias_name) && !empty($payload->room_alias_name)) {
$room_alias = "#{$payload->room_alias_name}:{$host}";
$check_alias = $entityManager->getRepository(Rooms::class)->findOneBy(['roomalias' => $room_alias]);
$check_alias = $entityManager->getRepository(Room::class)->findOneBy(['roomalias' => $room_alias]);
if (empty($check_alias)) {
$room->setRoomAlias($room_alias);
$response['room_alias'] = $room_alias;
Expand Down Expand Up @@ -295,7 +295,7 @@ public function kick(
$entityManager = $this->getDoctrine()->getManager();

// Check room exists.
$room = $entityManager->getRepository(Rooms::class)->findOneBy([
$room = $entityManager->getRepository(Room::class)->findOneBy([
'serverid' => $serverID,
'roomid' => $roomID,
]);
Expand Down Expand Up @@ -363,7 +363,7 @@ public function roomState(string $serverID, string $roomID, string $eventType, R
$entityManager = $this->getDoctrine()->getManager();

// Check room exists.
$room = $entityManager->getRepository(Rooms::class)->findOneBy([
$room = $entityManager->getRepository(Room::class)->findOneBy([
'serverid' => $serverID,
'roomid' => $roomID,
]);
Expand Down Expand Up @@ -441,7 +441,7 @@ public function getJoinedMembers(string $serverID, string $roomID, Request $requ
}

$entityManager = $this->getDoctrine()->getManager();
$room = $entityManager->getRepository(Rooms::class)->findOneBy([
$room = $entityManager->getRepository(Room::class)->findOneBy([
'serverid' => $serverID,
'roomid' => $roomID,
]);
Expand Down
8 changes: 4 additions & 4 deletions application/src/Controller/SynapseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use App\Entity\Users;
use App\Entity\Threepids;
use App\Entity\RoomMember;
use App\Entity\Rooms;
use App\Entity\Room;
use App\Entity\Tokens;
use App\Traits\GeneralTrait;
use App\Traits\MatrixSynapseTrait;
Expand Down Expand Up @@ -260,7 +260,7 @@ public function inviteUser(string $serverID, string $roomID, Request $request):
$entityManager = $this->getDoctrine()->getManager();

// Check room exists.
$room = $entityManager->getRepository(Rooms::class)->findOneBy([
$room = $entityManager->getRepository(Room::class)->findOneBy([
'serverid' => $serverID,
'roomid' => $roomID,
]);
Expand Down Expand Up @@ -344,7 +344,7 @@ public function deleteRoom(string $serverID, string $roomID, Request $request):
}

$entityManager = $this->getDoctrine()->getManager();
$room = $entityManager->getRepository(Rooms::class)->findOneBy([
$room = $entityManager->getRepository(Room::class)->findOneBy([
'serverid' => $serverID,
'roomid' => $roomID,
]);
Expand Down Expand Up @@ -380,7 +380,7 @@ public function roomInfo(string $serverID, string $roomID, Request $request): Js
$entityManager = $this->getDoctrine()->getManager();

// Check room exists.
$room = $entityManager->getRepository(Rooms::class)->findOneBy([
$room = $entityManager->getRepository(Room::class)->findOneBy([
'serverid' => $serverID,
'roomid' => $roomID,
]);
Expand Down
2 changes: 1 addition & 1 deletion application/src/Entity/Medias.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Repository\MediasRepository;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Rooms;
use App\Entity\Room;
use App\Entity\Users;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

namespace App\Entity;

use App\Repository\RoomsRepository;
use App\Repository\RoomRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\RoomMember;

/**
* @ORM\Entity(repositoryClass=RoomsRepository::class)
* @ORM\Entity(repositoryClass=RoomRepository::class)
*/
class Rooms
class Room
{
/**
* @ORM\Id
Expand Down
8 changes: 4 additions & 4 deletions application/src/Entity/RoomMember.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Repository\RoomMemberRepository;
use Doctrine\ORM\Mapping as ORM;
use App\Entity\Rooms;
use App\Entity\Room;
use App\Entity\Users;

/**
Expand All @@ -25,7 +25,7 @@ class RoomMember
private $serverid;

/**
* @ORM\ManyToOne(targetEntity=Rooms::class, inversedBy="members")
* @ORM\ManyToOne(targetEntity=Room::class, inversedBy="members")
* @ORM\JoinColumn(nullable=false)
*/
private $room;
Expand Down Expand Up @@ -73,12 +73,12 @@ public function setServerid(string $serverid): self
return $this;
}

public function getRoom(): Rooms
public function getRoom(): Room
{
return $this->room;
}

public function setRoom(Rooms $room): self
public function setRoom(Room $room): self
{
$this->room = $room;

Expand Down
2 changes: 1 addition & 1 deletion application/src/Entity/Users.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ public function getMemberships(): Collection
return $this->rooms;
}

public function getMembership(Rooms $room): Rooms
public function getMembership(Room $room): Room
{
return $this->rooms->get($room);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,32 @@

namespace App\Repository;

use App\Entity\Rooms;
use App\Entity\Room;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\ORM\OptimisticLockException;
use Doctrine\ORM\ORMException;
use Doctrine\Persistence\ManagerRegistry;

/**
* @extends ServiceEntityRepository<Rooms>
* @extends ServiceEntityRepository<Room>
*
* @method Rooms|null find($id, $lockMode = null, $lockVersion = null)
* @method Rooms|null findOneBy(array $criteria, array $orderBy = null)
* @method Rooms[] findAll()
* @method Rooms[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
* @method Room|null find($id, $lockMode = null, $lockVersion = null)
* @method Room|null findOneBy(array $criteria, array $orderBy = null)
* @method Room[] findAll()
* @method Room[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class RoomsRepository extends ServiceEntityRepository
class RoomRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Rooms::class);
parent::__construct($registry, Room::class);
}

/**
* @throws ORMException
* @throws OptimisticLockException
*/
public function add(Rooms $entity, bool $flush = true): void
public function add(Room $entity, bool $flush = true): void
{
$this->_em->persist($entity);
if ($flush) {
Expand All @@ -39,7 +39,7 @@ public function add(Rooms $entity, bool $flush = true): void
* @throws ORMException
* @throws OptimisticLockException
*/
public function remove(Rooms $entity, bool $flush = true): void
public function remove(Room $entity, bool $flush = true): void
{
$this->_em->remove($entity);
if ($flush) {
Expand Down
2 changes: 1 addition & 1 deletion application/src/Traits/MatrixSynapseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace App\Traits;

use Symfony\Component\HttpFoundation\JsonResponse;
use App\Entity\Rooms;
use App\Entity\Room;
use App\Entity\RoomMember;
use App\Entity\Tokens;
use App\Entity\Users;
Expand Down

0 comments on commit 1b059a7

Please sign in to comment.