Skip to content

Instantly share code, notes, and snippets.

@naoaki011
Forked from aklaswad/gist:844870
Created May 14, 2011 12:27
Show Gist options
  • Save naoaki011/972172 to your computer and use it in GitHub Desktop.
Save naoaki011/972172 to your computer and use it in GitHub Desktop.
search with meta column
#!/usr/bin/perl
use strict;
use warnings;
use lib qw( lib extlib );
use MT;
MT->new;
use Data::ObjectDriver;
$Data::ObjectDriver::DEBUG = 1;
MT->model('blog')->load(
{
# condition for blog columns
#name => { like => '%foo%', },
},
{ joins => [
MT->model('blog')->meta_pkg->join_on(
blog_id => {
# condition for meta columns
type => 'nofollow_urls',
vinteger => 1,
},
{
# sort by meta columns
#sort => 'vclob',
}
),
],
# sort by blog columns
#sort => 'create_on',
}
);
@naoaki011
Copy link
Author

EntryをEntryのテーブルとEntryのカスタムフィールドをキーに絞り込んで取得するコード
entryテーブルとentry_metaテーブルをjoinしてロードする必要がある。
結構面倒

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment