Sfoglia il codice sorgente

added Blog & Comment model

services
parent
commit
130f6b12aa
2 ha cambiato i file con 61 aggiunte e 0 eliminazioni
  1. 46
    0
      src/model/Blog.php
  2. 15
    0
      src/model/Comment.php

+ 46
- 0
src/model/Blog.php Vedi File

@@ -0,0 +1,46 @@
<?php

namespace Blog\Model;

use Blog\DB\Blog as BlogDB;
use Blog\Model\Comment;

class Blog {

protected $author;
protected $title;
protected $subtitle;
protected $date;
protected $content;
protected $comments;
protected $id;
protected $slug;

public function setAuthor($value) {
$this->author = $value;
}

public function setDate($value) {
$this->date = $value;
}

public function getDate() {
return $this->date;
}

public function getAuthor() {
return $this->author;
}

public function getComments() {
$comments = new Comment();
$this->comments = $comments->getComments($this->id);
return $this->comments;
}


public function save() {
$db = new BlogDB();
$db->createBlog($this);
}
}

+ 15
- 0
src/model/Comment.php Vedi File

@@ -0,0 +1,15 @@
<?php

namespace Blog\Model;

class Comment {
protected $user;
protected $date;
protected $blogID;
protected $comment;

public function getComments($blogID) {
// Vraag de DB om alle comment voor blogID
return [];
}
}

Loading…
Annulla
Salva