summaryrefslogtreecommitdiff
path: root/app/Model/ProjectNotification.php
blob: 49fcc61d3a0415ef1ad4b78fae9d62e257e6fd27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<?php

namespace Kanboard\Model;

/**
 * Project Notification
 *
 * @package  model
 * @author   Frederic Guillot
 */
class ProjectNotification extends Base
{
    /**
     * Send notifications
     *
     * @access public
     * @param  integer  $project_id
     * @param  string   $event_name
     * @param  array    $event_data
     */
    public function sendNotifications($project_id, $event_name, array $event_data)
    {
        $project = $this->project->getById($project_id);

        foreach ($this->projectNotificationType->getSelectedTypes($project_id) as $type) {
            $this->projectNotificationType->getType($type)->notifyProject($project, $event_name, $event_data);
        }
    }
}