Dave Rolsky > Fey-ORM-0.45 > Fey::Meta::Role::Relationship::HasOne

Download:
Fey-ORM-0.45.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  0
Stalled  1
View/Report Bugs
Module Version: 0.45   Source   Latest Release: Fey-ORM-0.46

NAME ^

Fey::Meta::Role::Relationship::HasOne - A role for has-one metaclasses

VERSION ^

version 0.45

DESCRIPTION ^

This role provides functionality for the two has-one metaclasses, Fey::Meta::HasOne::ViaFK and Fey::Meta::HasOne::ViaSelect.

CONSTRUCTOR OPTIONS ^

This role adds the following constructor options:

METHODS ^

This role provides the following methods:

$ho->name()

Corresponds to the value passed to the constructor.

$ho->table()

Corresponds to the value passed to the constructor.

$ho->foreign_table()

Corresponds to the value passed to the constructor.

$ho->is_cached()

Corresponds to the value passed to the constructor, or the calculated default.

$ho->allows_undef()

Corresponds to the value passed to the constructor.

$ho->handles()

Corresponds to the value passed to the constructor.

$ho->attach_to_class($class)

This method takes a Fey::Meta::Class::Table object and attaches the relationship to the associated class. If this relationship is cached, it creates a new attribute, otherwise it creates a new method.

The method/attribute returns an object belonging to the class associated with the foreign table. It can return undef if allows_undef is true.

$ho->associated_class()

The class associated with this object. This is undefined until $ho->attach_to_class() is called.

$ho->associated_attribute()

Returns the attribute associated with this object, if any.

$ho->associated_method()

Returns the method associated with this object, if any.

$ho->detach_from_class()

If this object was attached to a class, it removes any attribute or method it made, and unsets the associated_class.

AUTHOR ^

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2011 by Dave Rolsky.

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

syntax highlighting: