public static function getByName($name) { assert('is_string($name)'); assert('$name != ""'); $bean = R::findOne(EmailBox::getTableName('EmailBox'), "name = :name ", array(':name' => $name)); assert('$bean === false || $bean instanceof RedBean_OODBBean'); if ($bean === false) { throw new NotFoundException(); } else { $box = self::makeModel($bean); } $box->setSpecialBox(); return $box; }