[Dbix-class] Result->id

Hartmaier Alexander alexander.hartmaier at t-systems.at
Tue Nov 28 12:46:17 GMT 2017


Hi,

when you define your 'id' column using add_column it generates an
accessor method named 'id' which overwrites the id method of
DBIx::Class::PK.

Best regards, Alex


On 2017-11-28 10:56, Vladimir Melnik wrote:
> Dear colleagues,
>
> Is `id()` should return a content of the `id` column if it presents, even if we have a multi-column PK (so it's supposed to return a list of PK values as it described in the `DBIx::Class::Row` manual)?
>
> So, I have a table whose PKs are `id` and `known_from`, I have the following in the Result-based class definition:
>
>      __PACKAGE__->set_primary_key("id", "known_from");
>
> But it always return one number - the content of the `id` column.
>
> What overrides what: an internal method and a column-name-based method? If the column-name-based one has higher priority, should I consider renaming the `id` field to some crappy `_id`? Or would it be a better way to call it as '_id' when I'm doing `__PACKAGE__->add_columns("id", ...)`? If yes, would it be possible to ask `DBIx::Class::Schema::Loader` to do that each time?
>
> Thanks in advance for your time, dear colleagues.
>
> If anyone have experince with multi-column PK with DBIx::Class and with temporal (also as bi-temporal and multi-temporal) - please share your wisdom.
>



*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
T-Systems Austria GesmbH Rennweg 97-99, 1030 Wien
Handelsgericht Wien, FN 79340b
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*
Notice: This e-mail contains information that is confidential and may be privileged.
If you are not the intended recipient, please notify the sender and then
delete this e-mail immediately.
*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*"*



More information about the DBIx-Class mailing list