Re: [Catalyst] strange generated DBIC accessor name
DBIx::Class tends to pluralize relationships, so if you have a one to many relationship with a table "company_person", it will name it "company_people". Generally speaking this is also predictable :) t...@dix.cz wrote: Hello catal[yi]sters, I'm going to be crazzy about one generated accessor name: __PACKAGE__->has_many( "company_people", # I expected to be "company_persons" "Jf::Schema::Result::CompanyPerson", { "foreign.role" => "self.id" }, ); Other names seems to be predictable: __PACKAGE__->has_many( "company_addresses", "Jf::Schema::Result::CompanyAddress", { "foreign.role" => "self.id" }, ); I have no "people" pattern in my database. Did I miss something? The schema has been generated as usual: script/jf_create.pl model DB DBIC::Schema Jf::Schema create=static \ 'dbi:Pg:dbname=jf' tomas Thanx, Tomas ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/ -- Ben van Staveren phone: +62 81 70777529 email: benvanstave...@gmail.com ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] strange generated DBIC accessor name
On Wed, Mar 10, 2010 at 7:29 AM, wrote: >>> I'm going to be crazzy about one generated accessor name: >>> >>> __PACKAGE__->has_many( >>> "company_people", # I expected to be "company_persons" >>> "Jf::Schema::Result::CompanyPerson", >>> { "foreign.role" => "self.id" }, >>> ); >>> >>> I have no "people" pattern in my database. Did I miss something? >> >> People is the correct plural of person. Apparently Catalyst uses >> something fairly clever to generate the plurals for relationship names. > > Yes, that makes sense. > > I changed the name from "person" to persona to avoid that. > And than I got plural "personae" :-) > > This is apparently linguistically perfect, but I rather prefer to have > consistent (ugly) naming.. > > Does anybody knows how invoke the *_create script to avoid that? > > > thanx, > Tomas > > >> Regards, >> Denny >> >> > > This discussion really belongs on the DBIx::Class mailing list, not on the Catalyst mailing list. http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class As Frazer posted above, yes, you can override this: http://search.cpan.org/~rkitover/DBIx-Class-Schema-Loader-0.05003/lib/DBIx/Class/Schema/Loader/Base.pm#inflect_plural -J ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] strange generated DBIC accessor name
I'm going to be crazzy about one generated accessor name: __PACKAGE__->has_many( "company_people", # I expected to be "company_persons" "Jf::Schema::Result::CompanyPerson", { "foreign.role" => "self.id" }, ); I have no "people" pattern in my database. Did I miss something? People is the correct plural of person. Apparently Catalyst uses something fairly clever to generate the plurals for relationship names. Yes, that makes sense. I changed the name from "person" to persona to avoid that. And than I got plural "personae" :-) This is apparently linguistically perfect, but I rather prefer to have consistent (ugly) naming.. Does anybody knows how invoke the *_create script to avoid that? thanx, Tomas Regards, Denny ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] strange generated DBIC accessor name
On Wed, 2010-03-10 at 14:15 +0100, t...@dix.cz wrote: > Hello catal[yi]sters, > > I'm going to be crazzy about one generated accessor name: > > __PACKAGE__->has_many( >"company_people", # I expected to be "company_persons" >"Jf::Schema::Result::CompanyPerson", >{ "foreign.role" => "self.id" }, > ); > > I have no "people" pattern in my database. Did I miss something? People is the correct plural of person. Apparently Catalyst uses something fairly clever to generate the plurals for relationship names. Regards, Denny signature.asc Description: This is a digitally signed message part ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
Re: [Catalyst] strange generated DBIC accessor name
The plural forms of autogenerated relationships are handle by Lingua::EN::Inflect (I think), and that module will give the plural of 'person' as 'people' Overriding the defaults is documented here: http://search.cpan.org/~rkitover/DBIx-Class-Schema-Loader-0.05003/lib/DBIx/Class/Schema/Loader/Base.pm#inflect_plural f On Wed, Mar 10, 2010 at 1:15 PM, wrote: > > Hello catal[yi]sters, > > I'm going to be crazzy about one generated accessor name: > > __PACKAGE__->has_many( > "company_people", # I expected to be "company_persons" > "Jf::Schema::Result::CompanyPerson", > { "foreign.role" => "self.id" }, > ); > > Other names seems to be predictable: > > __PACKAGE__->has_many( > "company_addresses", > "Jf::Schema::Result::CompanyAddress", > { "foreign.role" => "self.id" }, > ); > > > I have no "people" pattern in my database. Did I miss something? > > The schema has been generated as usual: > > script/jf_create.pl model DB DBIC::Schema Jf::Schema create=static \ > 'dbi:Pg:dbname=jf' tomas > > Thanx, > Tomas > > ___ > List: Catalyst@lists.scsys.co.uk > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: > http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ > Dev site: http://dev.catalyst.perl.org/ > ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/
[Catalyst] strange generated DBIC accessor name
Hello catal[yi]sters, I'm going to be crazzy about one generated accessor name: __PACKAGE__->has_many( "company_people", # I expected to be "company_persons" "Jf::Schema::Result::CompanyPerson", { "foreign.role" => "self.id" }, ); Other names seems to be predictable: __PACKAGE__->has_many( "company_addresses", "Jf::Schema::Result::CompanyAddress", { "foreign.role" => "self.id" }, ); I have no "people" pattern in my database. Did I miss something? The schema has been generated as usual: script/jf_create.pl model DB DBIC::Schema Jf::Schema create=static \ 'dbi:Pg:dbname=jf' tomas Thanx, Tomas ___ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/