Example #1
0
 public static function parseCreatures($string)
 {
     $ids = array();
     $tags = explode(",", trim($string));
     foreach ($tags as $tag_name) {
         $tag = Model_Creature::find()->where('name', $tag_name)->get_one();
         // 新しいタグの場合はタグテーブルに追加
         if (!$tag) {
             $tag = new Model_Creature();
             $tag->name = $tag_name;
             $tag->save();
         }
         array_push($ids, $tag);
     }
     return $ids;
 }