[Dbix-class] exception_action fail after DBIC upgrade

2012-12-10 Thread Konstantin A. Pustovalov

Hello list!

I'm using exception_action feature. Some of my tests fail after 
upgrading 0.08196 - 0.08204

I have reduced  test case to the following: http://paste.scsys.co.uk/217862
exception_action is never get called in my setup. Am I doing something 
wrong or is it intended behavior?


Thanx in advance!


___
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/dbix-class@lists.scsys.co.uk

Re: [Dbix-class] Retrieving data from a link table

2012-12-10 Thread Jörg Braun
Hi,

I had a similar problem where the logical solution was to put an
additional attribute to the linking table. But I have not found a solution
besides fetching the data seperatly.

I am also interested how others solved this kind of problem.

Joerg

On Fri, 7 Dec 2012 16:53:06 +0100, Ekki Plicht (DF4OR) e...@plicht.de
wrote:
 Hi.
 Two tables with a many_to_many relation via a link table:
 
 Table of web pages:
 table webpage(id, filename, ...)
 
 Table of images:
 table images (id, filename, ...)
 
 Table linking pages and images:
 table img_grp_page (id_img, groupnumber, id_page)
 
 
 The many_to_many relation works fine, I can retrieve all images
belonging
 to a certain webpage and all webpages where a certain image is used.
 
 What I want to have is the 'group number' from the link table as well.
 Images are clustered in certain groups on a page, that information is
 represented by that group number.
 
 Is there a way to get this in one go (one query)?
 
 Of course I could get this item with a separate query since I know all
 required id's. Still - is there a simpler way? I know that there is a
 similiar phrased question on stackoverflow (not by me), which does not
 really help me.
 
 
 TIA,
 Ekki

___
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/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] Retrieving data from a link table

2012-12-10 Thread Peter Rabbitson
On Fri, Dec 07, 2012 at 04:53:06PM +0100, Ekki Plicht (DF4OR) wrote:
 Hi.
 Two tables with a many_to_many relation via a link table:
 
 Table of web pages:
 table webpage(id, filename, ...)
 
 Table of images:
 table images (id, filename, ...)
 
 Table linking pages and images:
 table img_grp_page (id_img, groupnumber, id_page)
 
 
 The many_to_many relation works fine, I can retrieve all images belonging
 to a certain webpage and all webpages where a certain image is used.
 
 What I want to have is the 'group number' from the link table as well.
 Images are clustered in certain groups on a page, that information is
 represented by that group number.
 
 Is there a way to get this in one go (one query)?

Of course there is. The key thing here is that many-to-many is *not*
a relationship (as prominently explained in several places in the docs).
All an m2m accessor really is is sugar for

$near-search_related('link')-search_related('far');

Furthermroe the entire purpose of an m2m is to hide away *entirely* the 
existence of the linker. Therefore the simple answer to your question 
is: do not use m2m ;)

my @linkers_with_fars
  = $near-search_related('link', {}, { prefetch = 'far' })

Cheers

___
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/dbix-class@lists.scsys.co.uk


Re: [Dbix-class] exception_action fail after DBIC upgrade

2012-12-10 Thread Peter Rabbitson
On Mon, Dec 10, 2012 at 12:30:52PM +0400, Konstantin A. Pustovalov wrote:
 Hello list!
 
 I'm using exception_action feature. Some of my tests fail after
 upgrading 0.08196 - 0.08204
 I have reduced  test case to the following: http://paste.scsys.co.uk/217862
 exception_action is never get called in my setup. Am I doing
 something wrong or is it intended behavior?

Unintended breakage due to lack of tests - so when a refactor broke it
things went unnoticed. Can you please add several tests like the one
attached to t/34exception_action.t[1], and we will fix it for the next
version.

Thanks!

[1] https://github.com/dbsrgits/dbix-class/blob/master/t/34exception_action.t


___
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/dbix-class@lists.scsys.co.uk


[Dbix-class] Re: New many-to-many warnings

2012-12-10 Thread Rippl, Steve
OK, my bad!  I had previously manually defined many-to-many relations for a
couple of the tables and now they're being autogenerated with the same
names.

Sorry!


On Thu, Dec 6, 2012 at 8:17 PM, Rippl, Steve rip...@woodlandschools.orgwrote:

 Hi,

 I have a Catalyst app using DBIx::Class and just updated to latest
 versions and suddenly I'm getting warnings when loading the schema from our
 Postgres DB that I hadn't seen before

 DBIx::Class is up to date. (0.08204)
 DBIx::Class::Schema::Loader is up to date. (0.07033)

 ***
 DBIx::Class::Carp::__ANON__():
 ***
 The many-to-many relationship 'roles' is trying to create a utility method
 called roles_rs.
 This will completely overwrite one such already existing method on class
 Site::Schema::Result::User.

 You almost certainly want to rename your method or the many-to-many
 relationship, as the functionality of the original method will not be
 accessible anymore.

 To disable this warning set to a true value the environment variable
 DBIC_OVERWRITE_HELPER_METHODS_OK

 *

 I'm getting a few of these on tables that I haven't altered in the
 interim, I'm not creating relationships manually, they're defined in the
 DB.  Are these utility methods new?  I'm not seeing them in the schema but
 I suppose that's what the warning is telling me?  Is it OK to just
 set DBIC_OVERWRITE_HELPER_METHODS_OK to true?

 Thanks,
 Steve

 --
 Steve Rippl
 Technology Director
 Woodland Public Schools
 360 841 2730




-- 
Steve Rippl
Technology Director
Woodland Public Schools
360 841 2730
___
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/dbix-class@lists.scsys.co.uk