Improve webhooks to call external url on task creation/modification

This commit is contained in:
Frédéric Guillot
2014-07-21 20:32:12 -02:30
parent 4ae655ced3
commit 9e1dcf21dc
18 changed files with 320 additions and 14 deletions

View File

@@ -0,0 +1,53 @@
<?php
namespace Event;
use Core\Listener;
use Model\Project;
/**
* Project modification date listener
*
* Update the last modified field for a project
*
* @package event
* @author Frederic Guillot
*/
class ProjectModificationDate implements Listener
{
/**
* Project model
*
* @accesss private
* @var \Model\Project
*/
private $project;
/**
* Constructor
*
* @access public
* @param \Model\Project $project Project model instance
*/
public function __construct(Project $project)
{
$this->project = $project;
}
/**
* Execute the action
*
* @access public
* @param array $data Event data dictionary
* @return bool True if the action was executed or false when not executed
*/
public function execute(array $data)
{
if (isset($data['project_id'])) {
$this->project->updateModificationDate($data['project_id']);
return true;
}
return false;
}
}