2009/3/16 Andreas Mock <[email protected]>: >> Taking a wild guess: >> >> $schema->resultset('Books'); >> >> returns rows with attributes defined in the Result class Book.pm > > Ha, there it is again...rows... ;-)
I think you're approaching the question from the other end to how DBIx::Class tends to represent it. DBIx::Class tends to think of what you get back as an object representing a row in the DB, which represents a concept (e.g. a book). You sound like you're coming from a .NET or Java background where you think of the database is a stored representation of an object which represents a book. It's much the same thing in the end. > Are these rows "Book"-Objects??? Yes. > Or do I have to use these row-objects with Book-attributes to > initialize/instanciate > a Book-Object. (an object with other methods besides methods usfull for > persistence) > Or is this by convention the same? You get a resultset, which you can loop over to get individual Book result objects, and result object (a) represents a book and (b) is a loaded version of a database row in the Book table. The Book object type can be changed: you can add additional methods and properties to the book by changing the object's code. So the objects that work with DBIx::Class are not *only* for DBIx::Class use, you can add business logic there too. Cheers, -- Ian. _______________________________________________ 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]
