From c5c096c1741fb2e87b759c259af0a581fa2dee3f Mon Sep 17 00:00:00 2001 From: willkoua Date: Thu, 2 Jun 2016 14:01:44 -0400 Subject: [PATCH] resolution du bug de l'issue 1196 --- .../20160602174229_update_projetc_fileds.php | 40 +++++++++++++++++++ src/Model/Entity/Project.php | 26 ++++++++++++ src/Model/Table/ProjectsTable.php | 1 + 3 files changed, 67 insertions(+) create mode 100644 config/Migrations/20160602174229_update_projetc_fileds.php diff --git a/config/Migrations/20160602174229_update_projetc_fileds.php b/config/Migrations/20160602174229_update_projetc_fileds.php new file mode 100644 index 00000000..2ced444f --- /dev/null +++ b/config/Migrations/20160602174229_update_projetc_fileds.php @@ -0,0 +1,40 @@ +table('projects'); + + $table->removeColumn('updated'); + $table->removeColumn('created'); + + $table->addColumn('created', 'datetime', ['default' => null, 'null' => true]); + $table->addColumn('modified', 'datetime', ['default' => null, 'null' => true]); + + $table->update(); + } +} diff --git a/src/Model/Entity/Project.php b/src/Model/Entity/Project.php index 69c895aa..5c9afd41 100644 --- a/src/Model/Entity/Project.php +++ b/src/Model/Entity/Project.php @@ -228,6 +228,32 @@ public function editMentors($mentors) return $mentors; } + /** + * Set the created + * + * @param string $created created + * + * @return string $created + */ + public function editCreated($created) + { + $this->set('created', $created); + return $created; + } + + /** + * Set the modified + * + * @param string $modified modified + * + * @return string $modified + */ + public function editModified($modified) + { + $this->set('modified', $modified); + return $modified; + } + /** * Modify mentors * diff --git a/src/Model/Table/ProjectsTable.php b/src/Model/Table/ProjectsTable.php index da8b6cc4..e7e1e3ac 100644 --- a/src/Model/Table/ProjectsTable.php +++ b/src/Model/Table/ProjectsTable.php @@ -84,6 +84,7 @@ public function initialize(array $config) 'joinTable' => 'projects_mentors' ] ); + $this->addBehavior('Timestamp'); } /**