Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 0 |
1 | <?php |
||
118 | public static function getByName(string $name): EmailTemplates |
||
119 | { |
||
120 | $emailTemplate = self::findFirst([ |
||
121 | 'conditions' => 'companies_id in (?0, 0) and apps_id in (?1, 0) and name = ?2 and is_deleted = 0', |
||
122 | 'bind' => [Di::getDefault()->getUserData()->currentCompanyId(), Di::getDefault()->getConfig()->app->id, $name] |
||
123 | ]); |
||
124 | |||
125 | if (!is_object($emailTemplate)) { |
||
126 | throw new UnprocessableEntityHttpException(_('No template ' . $name . ' found for this app ' . Di::getDefault()->getApp()->name)); |
||
127 | } |
||
128 | |||
129 | return $emailTemplate; |
||
130 | } |
||
132 |