[Jifty-commit] r2667 - in Jifty-DBI/branches/od: t

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Sat Jan 27 08:17:04 EST 2007


Author: audreyt
Date: Sat Jan 27 08:17:04 2007
New Revision: 2667

Modified:
   Jifty-DBI/branches/od/lib/Jifty/DBI/Schema.pm
   Jifty-DBI/branches/od/t/02records_object.t
   Jifty-DBI/branches/od/t/11schema_records.t
   Jifty-DBI/branches/od/t/12prefetch.t
   Jifty-DBI/branches/od/t/testmodels.pl

Log:
* Add new synonym "references" for "refers_to" as it has no underscores.

Modified: Jifty-DBI/branches/od/lib/Jifty/DBI/Schema.pm
==============================================================================
--- Jifty-DBI/branches/od/lib/Jifty/DBI/Schema.pm	(original)
+++ Jifty-DBI/branches/od/lib/Jifty/DBI/Schema.pm	Sat Jan 27 08:17:04 2007
@@ -70,6 +70,7 @@
         as          => '',
         ajax        => 'ajax_',
         refers_to   => sub { refers_to => @_ },
+        references  => sub { refers_to => @_ },
     },
 );
 use Class::Data::Inheritable;
@@ -77,10 +78,6 @@
 
 our @EXPORT = qw( defer lazy column schema by render_as since till );
 
-### We could export these two and make "refers to Foo::Bar" work, but it breaks when "by" is given. 
-# sub refers ($) { $_[0]->refers_to }
-# sub to (*) { $_[0] }
-
 sub by ($) { @_ }
 sub render_as ($) { render as @_ }
 sub since ($) { since is @_ }
@@ -357,13 +354,13 @@
 
 __END__
 
-=head2 refers_to
+=head2 references
 
 Indicates that the column references an object or a collection of objects in another
 class.  You may refer to either a class that inherits from Jifty::Record by a primary
 key in that class or to a class that inherits from Jifty::Collection.
 
-Correct usage is C<refers_to Application::Model::OtherClass by 'column_name'>, where
+Correct usage is C<references Application::Model::OtherClass by 'column_name'>, where
 Application::Model::OtherClass is a valid Jifty model and C<'column_name'> is
 a column containing unique values in OtherClass.  You can omit C<by 'column_name'> and
 the column name 'id' will be used.
@@ -376,7 +373,11 @@
 
 For columns referring to Jifty::Records you can access the actual value of the column
 instead of the object reference by appending '_id' to the column name.  As a result,
-you may not end any column name which uses 'refers_to' using '_id'.
+you may not end any column name which uses 'references' using '_id'.
+
+=head2 refers_to
+
+Synonym for C<references>.
 
 =cut
 

Modified: Jifty-DBI/branches/od/t/02records_object.t
==============================================================================
--- Jifty-DBI/branches/od/t/02records_object.t	(original)
+++ Jifty-DBI/branches/od/t/02records_object.t	Sat Jan 27 08:17:04 2007
@@ -119,7 +119,7 @@
 BEGIN {
     use Jifty::DBI::Schema;
     use Jifty::DBI::Record schema {
-    column employee => refers_to TestApp::Employee;
+    column employee => references TestApp::Employee;
     column phone    => type is 'varchar(18)';
     }
 }

Modified: Jifty-DBI/branches/od/t/11schema_records.t
==============================================================================
--- Jifty-DBI/branches/od/t/11schema_records.t	(original)
+++ Jifty-DBI/branches/od/t/11schema_records.t	Sat Jan 27 08:17:04 2007
@@ -266,7 +266,7 @@
     use Jifty::DBI::Schema;
     use Jifty::DBI::Record schema {
     column name => type is 'varchar';
-    column phones => refers_to TestApp::PhoneCollection by 'employee';
+    column phones => references TestApp::PhoneCollection by 'employee';
     }
 }
 
@@ -282,7 +282,7 @@
 BEGIN {
     use Jifty::DBI::Schema;
     use Jifty::DBI::Record schema {;
-    column employee => refers_to TestApp::Employee;
+    column employee => refers_to TestApp::Employee; # "refers_to" is the old synonym to "references"
     column phone    => type is 'varchar';
     }
 }

Modified: Jifty-DBI/branches/od/t/12prefetch.t
==============================================================================
--- Jifty-DBI/branches/od/t/12prefetch.t	(original)
+++ Jifty-DBI/branches/od/t/12prefetch.t	Sat Jan 27 08:17:04 2007
@@ -184,7 +184,7 @@
     use Jifty::DBI::Schema;
     use Jifty::DBI::Record schema {
     column name => type is 'varchar';
-    column phones => refers_to TestApp::PhoneCollection by 'employee';
+    column phones => references TestApp::PhoneCollection by 'employee';
     }
 }
 
@@ -194,7 +194,7 @@
 BEGIN {
     use Jifty::DBI::Schema;
     use Jifty::DBI::Record schema {
-    column employee => refers_to TestApp::Employee;
+    column employee => references TestApp::Employee;
     column phone    => type is 'varchar';
     }
 }

Modified: Jifty-DBI/branches/od/t/testmodels.pl
==============================================================================
--- Jifty-DBI/branches/od/t/testmodels.pl	(original)
+++ Jifty-DBI/branches/od/t/testmodels.pl	Sat Jan 27 08:17:04 2007
@@ -44,7 +44,7 @@
 use Jifty::DBI::Record schema {
 
 column employee_id =>
-  refers_to Sample::Employee;
+  references Sample::Employee;
 
 column name =>
   type is 'varchar',


More information about the Jifty-commit mailing list