Re: [Catalyst] More natural access to model?

2009-06-05 Thread Paweł Tęcza
Darren Duncan pisze: Paweł Tęcza wrote: Yes, I'm trying to think about my data as about the objects with attributes and create simple and flexible database without data redundancy. For example, I have tables for users and their roles, studies, units, registrations. I also have tables for

Re: [Catalyst] More natural access to model?

2009-05-15 Thread Paweł Tęcza
Darren Duncan pisze: Paweł Tęcza wrote: Intriguing post. My application and database design are still under heavy development, so all ideas, suggestions and comments are very welcome :D A general rule of thumb is that you should be conceptualizing your databases similar to how you

Re: [Catalyst] More natural access to model?

2009-05-13 Thread Matt S Trout
On Tue, May 12, 2009 at 08:04:18PM -0700, Darren Duncan wrote: Paweł Tęcza wrote: Dnia 2009-05-12, wto o godzinie 19:30 +0100, Matt S Trout pisze: Well, that's a horrible idea. The whole point of having a database is to -model- your data. If you try and turn it into a giant hash, then of

[Catalyst] More natural access to model?

2009-05-12 Thread Paweł Tęcza
Dear Catalyst users, It's my first post here, so I would like to say Hello to all of us! :) I'm writing my first Catalyst application for student registration and I have the following tables for details about studies at our university: CREATE TABLE studies ( id integer NOT NULL, unit_id

Re: [Catalyst] More natural access to model?

2009-05-12 Thread Zbigniew Lukasiak
2009/5/12 Paweł Tęcza pte...@uw.edu.pl: Dear Catalyst users, It's my first post here, so I would like to say Hello to all of us! :) I'm writing my first Catalyst application for student registration and I have the following tables for details about studies at our university: CREATE TABLE

Re: [Catalyst] More natural access to model?

2009-05-12 Thread Paweł Tęcza
Zbigniew Lukasiak pisze: 2009/5/12 Paweł Tęcza pte...@uw.edu.pl: So my question is: how can I modify my model to get the study details in the following, more natural way? Is it possibble at all? my @studies = $c-model('DB::Studies')-all; foreach my $study in (@studies) { $study_name

Re: [Catalyst] More natural access to model?

2009-05-12 Thread Kieren Diment
On 12/05/2009, at 8:57 PM, Paweł Tęcza wrote: Do you know solution of that issue? Maybe I should define subroutines in MyApp::Schema::ResultSet::Studies module for all type of data? Yes you should. That means that even though your code might be horrible, you can hide the

Re: [Catalyst] More natural access to model?

2009-05-12 Thread Paweł Tęcza
Kieren Diment pisze: On 12/05/2009, at 8:57 PM, Paweł Tęcza wrote: Do you know solution of that issue? Maybe I should define subroutines in MyApp::Schema::ResultSet::Studies module for all type of data? Yes you should. That means that even though your code might be horrible, you can

Re: [Catalyst] More natural access to model?

2009-05-12 Thread Tomas Doran
Paweł Tęcza wrote: Thank you very much for your response! Is it a way to autogenerate all necessary subroutines in a loop or I need define all of them manually? They should have very similar body :) Here is the gross method: no strict 'refs'; foreach my $name (qw/ method_one method_two /) {

Re: [Catalyst] More natural access to model?

2009-05-12 Thread Paweł Tęcza
Tomas Doran pisze: Paweł Tęcza wrote: Thank you very much for your response! Is it a way to autogenerate all necessary subroutines in a loop or I need define all of them manually? They should have very similar body :) Here is the gross method: no strict 'refs'; foreach my $name (qw/

Re: [Catalyst] More natural access to model?

2009-05-12 Thread Paweł Tęcza
Dnia 2009-05-12, wto o godzinie 19:30 +0100, Matt S Trout pisze: Well, that's a horrible idea. The whole point of having a database is to -model- your data. If you try and turn it into a giant hash, then of course you're going to end up with nasty code. I -could- explain how to clean

Re: [Catalyst] More natural access to model?

2009-05-12 Thread Darren Duncan
Paweł Tęcza wrote: Dnia 2009-05-12, wto o godzinie 19:30 +0100, Matt S Trout pisze: Well, that's a horrible idea. The whole point of having a database is to -model- your data. If you try and turn it into a giant hash, then of course you're going to end up with nasty code. I -could- explain