b0g1dan23 / Travely

0 stars 0 forks source link

Database - MySQL #1

Open ilicmarko opened 2 years ago

ilicmarko commented 2 years ago

I will split the review into three different issues.

  1. 1

  2. 2

  3. FE

Diagram

image

Without looking too much into what the platform goals are I will try to cover just the essential things I found.

General

Hotels

There is some strange logic that is based on the idHotela I don really get but if there are two types of entities Hotel Rooms and Apartments that should be another table and connected to the Hotel entity.

if ($type) {
    $ap_query .= " WHERE idHotela = 1";
    $roomHeading = 'Hotel Rooms';
} else {
    $ap_query .= " WHERE idHotela != 1";
    $roomHeading = 'Apartments';
}
b0g1dan23 commented 2 years ago

Što se tiče imena tabela, slažem se, trebalo je da pišem ili na srpskom ili engleskom, i to ću da izmenim odmah.

Što se tiče ovog idHotela u tabeli apartmani, ja sam imao neku ideju, koju očigledno nisam najbolje realizovao, da podelim apartmane na hotelske sobe i apartmane, u stvari trebalo je da se napravi zasebna tabela za hotelske sobe koja će da bude u relaciji jedan:više sa hotelima.

b0g1dan23 commented 2 years ago

Ja sam umesto deljenja na dve tabele, stavio da svaki apartman koji ima idHotela 1, bude apartman, a ostali da budu hotelske sobe

ilicmarko commented 2 years ago

This refactoring can be a good opportunity to add Model classes to the project. You can do this if you want to practice and focus on BE.

You can create a model for each entity and have all the functions for inserting and fetching data there.

If you want to learn PHP MVC I still think one of the best options is to use CodeIgniter. It is a really simple and powerful framework that uses the basics of MVC without any magic.

I have a really old tutorial on this topic that you can use if you want.

https://www.youtube.com/watch?v=FtpwPwU9Ue8