[Dbix-class] Re: new name for "as"

Steven Mackenzie dbix at aptile.co.uk
Fri Nov 3 11:04:47 GMT 2006


Steven Mackenzie wrote:
> A. Pagaltzis wrote:
>   
>> * Matt S Trout <dbix-class at trout.me.uk> [2006-11-03 09:50]:
>>   
>>     
>>> Anybody got any suggestions on a new name? construct_as maybe?
>>>     
>>>       
>> `accessor_name`?
>>
>> Regards,
>>   
>>     
> 'accessor_name' isn't really appropriate becuase the docs state that no
> actual accessor is created, and you must use ->get_column('<name>'.)
> Although it would seem sensible to change the behaviour to create the
> accessor wouldn't it? Is there a reason that no accessor is created at
> the moment?
>
> Or
> 'is':
> $rs = $schema->resultset('Employee')->search(undef,
>   {
>     select => [ 'name', { count => 'employeeid' } ],
>     is => ['name', 'employee_count'],
>   });
>
> 'access_as':
> $rs = $schema->resultset('Employee')->search(undef,
>   {
>     select => [ 'name', { count => 'employeeid' } ],
>     access_as => ['name', 'employee_count'],
>   });
>
> 'accessor': # with the appropriate change of behaviour
> $rs = $schema->resultset('Employee')->search(undef,
>   {
>     select => [ 'name', { count => 'employeeid' } ],
>     accessor => ['name', 'employee_count'],
>   });
>
>   
'column_key' :

$rs = $schema->resultset('Employee')->search(undef,
  {
    select => [ 'name', { count => 'employeeid' } ],
    column_key => ['name', 'employee_count'],
  });

$rs->first->get_column('employee_count');



More information about the Dbix-class mailing list