get_primary_key( context, pk_value )

Should return an array of the name of the field(s) to fetch() pk_value from and their respective values.

The default behaviour is to return primary_key and the corresponding value(s) from pk_value.

However, if you have other unique fields in your schema, you might return a unique field other than the primary key. This allows for a more flexible URI scheme.

A good example is Users. A User record might have a numerical id (uid) and a username, both of which are unique. So if username 'foobar' has a primary_key (uid) of '1234', both these URIs could fetch the same record:

/uri/for/user/1234
/uri/for/user/foobar

Again, the default behaviour is to return the primary_key field name(s) from config() (accessed via $self->primary_key) but you can override get_primary_key() in your subclass to provide more flexibility.

If your primary key is composed of multiple columns, your return value should include all those columns and their values as extracted from pk_value. Multiple values are assumed to be joined with ;;. See make_primary_key_string().

make_primary_key_string( object )

Using value of primary_string constructs a URI-ready string based on values in object. object is often the value of:

$c->stash->{object}

but could be any object that has accessor methods with the same names as the field(s) specified by primary_key.

Multiple values are joined with ;; and any ; or / characters in the column values are URI-escaped.

instantiate_model_adapter( app_class )

If model_adapter() is set to a string of the adapter class name, this method will instantiate the model_adapter with its new() method, passing in model_name(), model_meta() and app_class.

do_model( context, method, args )

Checks for presence of model_adapter() instance and calls method on either model() or model_adapter() as appropriate.

model_can( context, method_name )

Returns can() value from model_adapter() or model() as appropriate.

AUTHOR

Peter Karman, <perl at peknet.com>

BUGS

Please report any bugs or feature requests to bug-catalystx-crud at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=CatalystX-CRUD. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc CatalystX::CRUD

You can also look for information at:

ACKNOWLEDGEMENTS

Thanks to Zbigniew Lukasiak and Matt Trout for feedback and API ideas.

COPYRIGHT & LICENSE

Copyright 2007 Peter Karman, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.