aboutsummaryrefslogtreecommitdiff
path: root/app/class/Page.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2020-01-29 02:34:50 +0100
committervincent-peugnet <v.peugnet@free.fr>2020-01-29 02:34:50 +0100
commit64ac1605b6fe8e997134dd57cc30f30b99ebc076 (patch)
treed4fd89c68f0f0eb7b49ea92336f8f8ab5f778e45 /app/class/Page.php
parentb6173772bdef1eaf067573373ab500d67dfc454d (diff)
downloadwcms-64ac1605b6fe8e997134dd57cc30f30b99ebc076.tar.gz
wcms-64ac1605b6fe8e997134dd57cc30f30b99ebc076.zip
refactor : item abstract class
new Item abstract class with hydrate and dry functions to clean others
Diffstat (limited to 'app/class/Page.php')
-rw-r--r--app/class/Page.php26
1 files changed, 1 insertions, 25 deletions
diff --git a/app/class/Page.php b/app/class/Page.php
index 170a057..82e61c1 100644
--- a/app/class/Page.php
+++ b/app/class/Page.php
@@ -6,7 +6,7 @@ use DateTime;
use DateTimeImmutable;
use DateTimeZone;
-class Page
+class Page extends Dbitem
{
protected $id;
protected $title;
@@ -63,17 +63,6 @@ class Page
$this->hydrate($datas);
}
- public function hydrate($datas)
- {
- foreach ($datas as $key => $value) {
- $method = 'set' . $key;
-
- if (method_exists($this, $method)) {
- $this->$method($value);
- }
- }
- }
-
public function reset()
{
$now = new DateTimeImmutable(null, timezone_open("Europe/Paris"));
@@ -125,19 +114,6 @@ class Page
return ['pagevarlist' => $classvarlist];
}
- public function dry()
- {
- $array = [];
- foreach (get_class_vars(__class__) as $var => $value) {
- if (in_array($var, self::VAR_DATE)) {
- $array[$var] = $this->$var('string');
- } else {
- $array[$var] = $this->$var();
- }
- }
- return $array;
- }
-
/**
* Check if page have a thumbnail
* @return bool true if the page have a thumbnail otherwise return false.