Refactor Controller and models anhand der bibarts.sql und unbrauchbare Controllers und Models entfernt.
This commit is contained in:
@@ -8,7 +8,7 @@ class StandortModel extends Database {
|
||||
|
||||
public function getStandorte() {
|
||||
$pdo = $this->linkDB();
|
||||
$sql = "SELECT * FROM Standort ORDER BY standortid ASC;";
|
||||
$sql = "SELECT * FROM location ORDER BY location_id ASC;";
|
||||
try {
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute();
|
||||
@@ -19,10 +19,10 @@ class StandortModel extends Database {
|
||||
}
|
||||
}
|
||||
|
||||
public function getStandort($standortid) {
|
||||
public function getStandort($location_id) {
|
||||
$pdo = $this->linkDB();
|
||||
$sql = "SELECT * FROM Standort WHERE standortid = :standortid;";
|
||||
$params = [":standortid" => $standortid];
|
||||
$sql = "SELECT * FROM location WHERE location_id = :location_id;";
|
||||
$params = [":location_id" => $location_id];
|
||||
try {
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute($params);
|
||||
@@ -35,15 +35,15 @@ class StandortModel extends Database {
|
||||
|
||||
public function createStandort($data) {
|
||||
$pdo = $this->linkDB();
|
||||
$sql = "INSERT INTO Standort (straße, hausnr, postleitzahl, ort, land, tel, email)
|
||||
VALUES (:straße, :hausnr, :postleitzahl, :ort, :land, :tel, :email);";
|
||||
$sql = "INSERT INTO location (street, house_number, postal_code, city, country, phone, email)
|
||||
VALUES (:street, :house_number, :postal_code, :city, :country, :phone, :email);";
|
||||
$params = [
|
||||
":straße" => $data['straße'],
|
||||
":hausnr" => $data['hausnr'],
|
||||
":postleitzahl" => $data['postleitzahl'],
|
||||
":ort" => $data['ort'],
|
||||
":land" => $data['land'],
|
||||
":tel" => $data['tel'],
|
||||
":street" => $data['street'],
|
||||
":house_number" => $data['house_number'],
|
||||
":postal_code" => $data['postal_code'],
|
||||
":city" => $data['city'],
|
||||
":country" => $data['country'],
|
||||
":phone" => $data['phone'],
|
||||
":email" => $data['email']
|
||||
];
|
||||
try {
|
||||
@@ -56,26 +56,26 @@ class StandortModel extends Database {
|
||||
}
|
||||
}
|
||||
|
||||
public function updateStandort($standortid, $data) {
|
||||
public function updateStandort($location_id, $data) {
|
||||
$pdo = $this->linkDB();
|
||||
$sql = "UPDATE Standort SET
|
||||
straße = :straße,
|
||||
hausnr = :hausnr,
|
||||
postleitzahl = :postleitzahl,
|
||||
ort = :ort,
|
||||
land = :land,
|
||||
tel = :tel,
|
||||
$sql = "UPDATE location SET
|
||||
street = :street,
|
||||
house_number = :house_number,
|
||||
postal_code = :postal_code,
|
||||
city = :city,
|
||||
country = :country,
|
||||
phone = :phone,
|
||||
email = :email
|
||||
WHERE standortid = :standortid;";
|
||||
WHERE location_id = :location_id;";
|
||||
$params = [
|
||||
":straße" => $data['straße'],
|
||||
":hausnr" => $data['hausnr'],
|
||||
":postleitzahl" => $data['postleitzahl'],
|
||||
":ort" => $data['ort'],
|
||||
":land" => $data['land'],
|
||||
":tel" => $data['tel'],
|
||||
":street" => $data['street'],
|
||||
":house_number" => $data['house_number'],
|
||||
":postal_code" => $data['postal_code'],
|
||||
":city" => $data['city'],
|
||||
":country" => $data['country'],
|
||||
":phone" => $data['phone'],
|
||||
":email" => $data['email'],
|
||||
":standortid" => $standortid
|
||||
":location_id" => $location_id
|
||||
];
|
||||
try {
|
||||
$sth = $pdo->prepare($sql);
|
||||
@@ -87,10 +87,10 @@ class StandortModel extends Database {
|
||||
}
|
||||
}
|
||||
|
||||
public function deleteStandort($standortid) {
|
||||
public function deleteStandort($location_id) {
|
||||
$pdo = $this->linkDB();
|
||||
$sql = "DELETE FROM Standort WHERE standortid = :standortid;";
|
||||
$params = [":standortid" => $standortid];
|
||||
$sql = "DELETE FROM location WHERE location_id = :location_id;";
|
||||
$params = [":location_id" => $location_id];
|
||||
try {
|
||||
$sth = $pdo->prepare($sql);
|
||||
$sth->execute($params);
|
||||
|
Reference in New Issue
Block a user