mirror of
https://github.com/pierre42100/ComunicAPI
synced 2024-11-23 22:09:29 +00:00
Created BaseUniqueObjectFromUser
This commit is contained in:
parent
94e2a659b5
commit
e849b84172
32
classes/models/BaseUniqueObjectFromUser.php
Normal file
32
classes/models/BaseUniqueObjectFromUser.php
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Unique object with an ID created by a user base class
|
||||||
|
*
|
||||||
|
* @author Pierre HUBERT
|
||||||
|
*/
|
||||||
|
|
||||||
|
class BaseUniqueObjectFromUser extends BaseUniqueObject {
|
||||||
|
|
||||||
|
//Private fields
|
||||||
|
private $userID = 0;
|
||||||
|
private $time_sent;
|
||||||
|
|
||||||
|
//Set and get user ID
|
||||||
|
public function set_userID(int $userID){
|
||||||
|
$this->userID = $userID;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_userID() : int {
|
||||||
|
return $this->userID;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Set and get creation time
|
||||||
|
public function set_time_sent(int $time_sent){
|
||||||
|
$this->time_sent = $time_sent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get_time_sent() : int {
|
||||||
|
return $this->time_sent;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -5,12 +5,10 @@
|
|||||||
* @author Pierre HUBERT
|
* @author Pierre HUBERT
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Comment extends BaseUniqueObject {
|
class Comment extends BaseUniqueObjectFromUser {
|
||||||
|
|
||||||
//Private fields
|
//Private fields
|
||||||
private $userID;
|
|
||||||
private $postID;
|
private $postID;
|
||||||
private $time_sent;
|
|
||||||
private $content;
|
private $content;
|
||||||
private $img_path;
|
private $img_path;
|
||||||
private $img_url;
|
private $img_url;
|
||||||
@ -23,19 +21,9 @@ class Comment extends BaseUniqueObject {
|
|||||||
public function __construct(){
|
public function __construct(){
|
||||||
//Initialize some values
|
//Initialize some values
|
||||||
$this->postID = 0;
|
$this->postID = 0;
|
||||||
$this->userID = 0;
|
|
||||||
$this->likes = -1;
|
$this->likes = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set and get user ID
|
|
||||||
public function set_userID(int $userID){
|
|
||||||
$this->userID = $userID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function get_userID() : int {
|
|
||||||
return $this->userID;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Set and get post ID
|
//Set and get post ID
|
||||||
public function set_postID(int $postID){
|
public function set_postID(int $postID){
|
||||||
$this->postID = $postID;
|
$this->postID = $postID;
|
||||||
@ -49,15 +37,6 @@ class Comment extends BaseUniqueObject {
|
|||||||
return $this->postID;
|
return $this->postID;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Set and get creation time
|
|
||||||
public function set_time_sent(int $time_sent){
|
|
||||||
$this->time_sent = $time_sent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function get_time_sent() : int {
|
|
||||||
return $this->time_sent;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Set and get content
|
//Set and get content
|
||||||
public function set_content(string $content){
|
public function set_content(string $content){
|
||||||
$this->content = $content == "" ? null : $content;
|
$this->content = $content == "" ? null : $content;
|
||||||
|
Loading…
Reference in New Issue
Block a user