Allow CDBI objects to be accessed like hashes as people tend to do for
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat.pm
CommitLineData
ea2e61bf 1package DBIx::Class::CDBICompat;
2
3use strict;
4use warnings;
75a23b3e 5use base qw/DBIx::Class::Core DBIx::Class::DB/;
289ba852 6use Carp::Clan qw/^DBIx::Class/;
7
8eval {
9 require Class::Trigger;
10 require DBIx::ContextualFetch;
11};
12croak "Class::Trigger and DBIx::ContextualFetch is required for CDBICompat" if $@;
126042ee 13
55e2d745 14__PACKAGE__->load_own_components(qw/
15 Constraints
16 Triggers
17 ReadOnly
55e2d745 18 LiveObjectIndex
19 AttributeAPI
20 Stringify
21 DestroyWarning
22 Constructor
23 AccessorMapping
24 ColumnCase
55e2d745 25 HasA
75a23b3e 26 HasMany
503536d5 27 MightHave
e60dc79f 28 Copy
55e2d745 29 LazyLoading
30 AutoUpdate
31 TempColumns
e60dc79f 32 GetSet
55e2d745 33 Retrieve
2a21de92 34 Pager
55e2d745 35 ColumnGroups
5ef62e9f 36 ColumnsAsHash
e60dc79f 37 AbstractSearch
38 ImaDBI
39 Iterator
40/);
55e2d745 41
42 #DBIx::Class::ObjIndexStubs
ea2e61bf 431;
34d52be2 44
75d07914 45=head1 NAME
34d52be2 46
880a1a0c 47DBIx::Class::CDBICompat - Class::DBI Compatibility layer.
34d52be2 48
15fe6346 49=head1 SYNOPSIS
50
51 use base qw/DBIx::Class/;
52 __PACKAGE__->load_components(qw/CDBICompat Core DB/);
53
34d52be2 54=head1 DESCRIPTION
55
880a1a0c 56DBIx::Class features a fully featured compatibility layer with L<Class::DBI>
e7d1440f 57and L<Class::DBI::AbstractSearch> to ease transition for existing CDBI users.
58
59In fact, this class is just a receipe containing all the features emulated.
60If you like, you can choose which features to emulate by building your
61own class and loading it like this:
15fe6346 62
63 __PACKAGE__->load_own_components(qw/CDBICompat/);
64
75d07914 65this will automatically load the features included in My::DB::CDBICompat,
15fe6346 66provided it looks something like this:
67
68 package My::DB::CDBICompat;
69 __PACKAGE__->load_components(qw/
70 CDBICompat::ColumnGroups
71 CDBICompat::Retrieve
72 CDBICompat::HasA
73 CDBICompat::HasMany
74 CDBICompat::MightHave
75 /);
76
2053ab2a 77=head1 COMPONENTS
15fe6346 78
79=over 4
80
81=item AccessorMapping
82
e60dc79f 83=item AbstractSearch
84
85Compatibility with Class::DBI::AbstractSearch.
86
15fe6346 87=item AttributeAPI
88
89=item AutoUpdate
90
91Allows you to turn on automatic updates for column values.
92
93=item ColumnCase
94
95=item ColumnGroups
96
97=item Constraints
98
99=item Constructor
100
101=item DestroyWarning
102
103=item GetSet
104
105=item HasA
106
15fe6346 107=item HasMany
108
15fe6346 109=item ImaDBI
110
111=item LazyLoading
112
113=item LiveObjectIndex
114
115The live object index tries to ensure there is only one version of a object
880a1a0c 116in the perl interpreter.
15fe6346 117
118=item MightHave
119
15fe6346 120=item ObjIndexStubs
121
122=item ReadOnly
123
124=item Retrieve
125
126=item Stringify
127
128=item TempColumns
129
130=item Triggers
131
15fe6346 132=item PassThrough
133
134=back
34d52be2 135
e7d1440f 136=head1 LIMITATIONS
137
138The following methods and classes are not emulated, maybe in the future.
139
140=over 4
141
142=item Class::DBI::Query
143
144Deprecated in Class::DBI.
145
146=item Class::DBI::Column
147
148Not documented in Class::DBI. CDBICompat's columns() returns a plain string, not an object.
149
150=item data_type()
151
152Undocumented CDBI method.
153
154=item meta_info()
155
156Undocumented CDBI method.
157
158=back
159
34d52be2 160=head1 AUTHORS
161
daec44b8 162Matt S. Trout <mst@shadowcatsystems.co.uk>
34d52be2 163
164=head1 LICENSE
165
166You may distribute this code under the same terms as Perl itself.
167
168=cut
169