dbsrgits / dbix-class-schema-loader

Official GitHub remote for git.shadowcat.co.uk DBIx-Class-Schema-Loader.git
http://dbix-class.org/
11 stars 34 forks source link

Add no_nonmoose option #22

Open smith153 opened 4 years ago

smith153 commented 4 years ago

When combined with use_moose, doesn't add MooseX::NonMoose to result classes

karenetheridge commented 4 years ago

Why would you want to do that? That would break DBIx::Class functionality.

smith153 commented 4 years ago

@karenetheridge Don't know, but was a requirement for an existing project.

karenetheridge commented 4 years ago

Did you try setting use_moose to false?

jbakerdev commented 2 years ago

@karenetheridge @smith153 If the result classes inherit from a result_base_class that is already moosified, then there is no need for MooseX::NonMoose, no?

I moosified the base class in an attempt to silence warnings like this:

Not inlining 'new' for MyApp::Schema::Result::Thing since it is not inheriting the default Moose::Object::new
If you are certain you don't need to inline your constructor, specify inline_constructor => 0 in your call to MyApp::Schema::Result::Thing->meta->make_immutable

I thought I was being clever with this (instead of adding "inline_constructor => 0" to all my result classes) but then I remembered that I shouldn't be modifying the generated classes... and here I am...

Thoughts/suggestions?

karenetheridge commented 2 years ago

f the result classes inherit from a result_base_class that is already moosified, then there is no need for MooseX::NonMoose, no?

Loader could be smarter and examine the base class(es) to see if MooseX::NonMoose is necessary. It looks like the code for that is at about line 2065 of DBIx/Class/Schema/Loader/Base.pm.