| 38 | | __PACKAGE__->table("system_tagging"); |
|---|
| 39 | | __PACKAGE__->columns(TEMP => qw/count/); |
|---|
| 40 | | __PACKAGE__->columns(Essential => qw/id tag photo/); |
|---|
| 41 | | __PACKAGE__->set_sql(summary => qq/ |
|---|
| 42 | | SELECT id, system_tag, count(*) AS count |
|---|
| 43 | | FROM system_tagging |
|---|
| 44 | | GROUP BY system_tag |
|---|
| 45 | | ORDER BY count DESC |
|---|
| 46 | | LIMIT 50 |
|---|
| 47 | | /); |
|---|
| 48 | | __PACKAGE__->set_sql(all => qq/ |
|---|
| 49 | | SELECT id, tag, count(*) AS count |
|---|
| 50 | | FROM system_tagging |
|---|
| 51 | | GROUP BY system_tag |
|---|
| 52 | | ORDER BY count DESC |
|---|
| 53 | | /); |
|---|
| 54 | | Memories::SystemTagging->has_a("photo" => "Memories::Photo"); |
|---|
| 55 | | Memories::SystemTagging->has_a("tag" => "Memories::SystemTag"); |
|---|
| 56 | | |
|---|
| 57 | | Memories::Photo->has_many(system_tags => ["Memories::SystemTagging" => "system_tag"]); |
|---|
| 58 | | Memories::Photo->has_many(system_taggings => "Memories::SystemTagging"); |
|---|
| 59 | | Memories::SystemTag->has_many(photos => ["Memories::SystemTagging" => "photo"] ); |
|---|
| 60 | | Memories::SystemTag->has_many(system_taggings => "Memories::SystemTagging"); |
|---|
| 61 | | |
|---|