> On 13 March 2012 16:33, Sung Gong <[email protected]> wrote:
>> Hi
>>
>> I have a simple User table (mysql back-end) which is mapped into a
>> resultsource class User.pm. statically generated by the helper.
>>
>> Just wondering any difference between
>> "MyApp::Schema::DB::Result::User" and "MyApp::Model::DB::User"?
Yes.
The ::Result:: class represents a specific database row.
The MyApp::Model::DB::User class is a tiny wrapper around
MyApp::Schema::DB::ResultSet::User, which represents a query (i.e. a set of
results)
>> Both ref($c->model("DB::User")->find(1)) and
>> ref($c->model("NECTAR::User")->new_result({})) return
>> MyApp::Model::DB::User.
>> Is this normally what I expect? (or MyApp::Schema::DB::Result::User)
Yes.
->find on a ResultSet will return a Result
->new_result on a ResultSet will return a Result.
>>
>> One more question re the method 'new_result' of DBIx::Class::ResultSet:
>> I found $c->model("DB::User")->new_result({})->result_source->schema->storage
>> returns undef, whereas
>> $c->model("DB::User")->find(1)->result_source->schema->storage doesn't
>> (it shows DBIx::Class::Storage::DBI::mysql=HASH(0x1f21fdc0)).
>> Is this also sane?
Yes.
Rows which aren't stored yet don't have storage.
Cheers
t0m
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[email protected]