[Catalyst] add_columns()

Moritz Onken onken at houseofdesign.de
Sun Jul 19 12:44:53 GMT 2009


Am 19.07.2009 um 13:21 schrieb Octavian Râşniţă:

> Hi,
>
> In DBIx::Class::ResultSource.pm's POD documentation I read:
>
> ""
> add_columns
> ...
>   Adds columns to the result source. If supplied key => hashref pairs,
>   uses the hashref as the column_info for that column. Repeated  
> calls of
>   this method will add more columns, not replace them.
> ""
>
> But in Catalyst::Manual::Tutorial::04_BasicCRUD.pod I read:
>
> ""
>       __PACKAGE__->add_columns(
>           "created",
>           { data_type => 'datetime', set_on_create => 1 },
>           "updated",
>           { data_type => 'datetime', set_on_create => 1,  
> set_on_update => 1 },
>       );
>
>   This will override the definition for these fields that  
> Schema::Loader
>   placed at the top of the file.
> ""
>
> What's the truth? Repeating calls of this method adds more columns  
> and not replace them, or the columns are overriden?

They are replaced if the name you supply matches a previously setup  
column.

So both is true :-)

cheers


More information about the Catalyst mailing list