static function getTypeId($type) { $email_type = EmailTypes::findOne(array('conditions' => array("`name` = ?", $type))); if (!is_null($email_type)) { return $email_type->getId(); } else { return null; } }