[jifty-devel] Re: [Jifty-commit] r3911 - in Jifty-DBI/trunk: .
lib/Jifty/DBI
Andrew Sterling Hanenkamp
sterling at hanenkamp.com
Thu Aug 16 16:15:28 EDT 2007
I was afraid that. :(
On 8/16/07, jifty-commit at lists.jifty.org <jifty-commit at lists.jifty.org>
wrote:
>
> Author: trs
> Date: Thu Aug 16 15:59:16 2007
> New Revision: 3911
>
> Modified:
> Jifty-DBI/trunk/ (props changed)
> Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm
> Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm
> Jifty-DBI/trunk/t/11schema_records.t
>
> Log:
> r26169 at zot: tom | 2007-08-16 15:58:56 -0400
> Backup r3908 for now since it breaks existing code
>
>
> Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm
>
> ==============================================================================
> --- Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm (original)
> +++ Jifty-DBI/trunk/lib/Jifty/DBI/Record.pm Thu Aug 16 15:59:16 2007
> @@ -259,20 +259,11 @@
> if ( $column->readable ) {
> if ( UNIVERSAL::isa( $column->refers_to,
> "Jifty::DBI::Record" ) )
> {
> - if ($column->virtual) {
> - $subref = sub {
> - if ( @_ > 1 ) { Carp::carp "Value passed to
> column accessor. You probably want to use the mutator." }
> - $_[0]->_to_record( $column_name,
> - $_[0]->id );
> - };
> - }
> - else {
> - $subref = sub {
> - if ( @_ > 1 ) { Carp::carp "Value passed to
> column accessor. You probably want to use the mutator." }
> - $_[0]->_to_record( $column_name,
> - $_[0]->__value($column_name) );
> - };
> - }
> + $subref = sub {
> + if ( @_ > 1 ) { Carp::carp "Value passed to
> column accessor. You probably want to use the mutator." }
> + $_[0]->_to_record( $column_name,
> + $_[0]->__value($column_name) );
> + };
> } elsif (
> UNIVERSAL::isa(
> $column->refers_to, "Jifty::DBI::Collection"
>
> Modified: Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm
>
> ==============================================================================
> --- Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm (original)
> +++ Jifty-DBI/trunk/lib/Jifty/DBI/Schema.pm Thu Aug 16 15:59:16 2007
> @@ -346,9 +346,6 @@
> # A one-to-one or one-to-many relationship is requested
> if ( UNIVERSAL::isa( $refclass, 'Jifty::DBI::Record' ) ) {
>
> - # Make this a virtual record reference if they set by
> - $column->virtual(1) if defined $column->by and $column->by ne
> 'id';
> -
> # Handle *_id reference columns specially
> if ( $name =~ /(.*)_id$/ ) {
> my $aliased_as = $1;
>
> Modified: Jifty-DBI/trunk/t/11schema_records.t
>
> ==============================================================================
> --- Jifty-DBI/trunk/t/11schema_records.t (original)
> +++ Jifty-DBI/trunk/t/11schema_records.t Thu Aug 16 15:59:16 2007
> @@ -9,7 +9,7 @@
> BEGIN { require "t/utils.pl" }
> our (@available_drivers);
>
> -use constant TESTS_PER_DRIVER => 74;
> +use constant TESTS_PER_DRIVER => 67;
>
> my $total = scalar(@available_drivers) * TESTS_PER_DRIVER;
> plan tests => $total;
> @@ -193,20 +193,8 @@
> is($ph->phone, '7890');
> is($phone_collection->next, undef);
> }
> -
> - is($emp->favorite_color->id, undef, 'emp 1 has no favorite color
> yet');
> - is($emp2->favorite_color->id, undef, 'emp 2 has no favorite color
> yet');
>
> - my $color = TestApp::Color->new( handle => $handle );
> - my $c_id = $color->create( employee => $emp, color => 'magenta'
> );
> - ok($c_id, "Got an id for the new color: $c_id");
> - $color->load($c_id);
> - is($color->id, $c_id);
> - is($emp->favorite_color->id, $c_id, 'emp fave id matches color
> id');
> - $emp->favorite_color->set_color('cyan');
> - is($emp->favorite_color->color, 'cyan', 'changed color to cyan');
> - $color->load($c_id);
> - is($color->color, 'cyan', 'changed the original too');
> +
>
> cleanup_schema( 'TestApp', $handle );
> disconnect_handle( $handle );
> @@ -228,14 +216,8 @@
> id integer primary key,
> employee integer NOT NULL,
> phone varchar(18)
> -)
> -}, q{
> -CREATE table colors (
> - id integer primary key,
> - employee integer NOT NULL,
> - color varchar(8)
> -)
> -} ]
> +) }
> +]
> }
>
> sub schema_mysql {
> @@ -250,12 +232,6 @@
> employee integer NOT NULL,
> phone varchar(18)
> )
> -}, q{
> -CREATE TEMPORARY table colors (
> - id integer AUTO_INCREMENT primary key,
> - employee integer NOT NULL,
> - color varchar(8)
> -)
> } ]
> }
>
> @@ -271,13 +247,7 @@
> employee integer references employees(id),
> phone varchar
> )
> -}, q{
> -CREATE TEMPORARY table colors (
> - id serial PRIMARY KEY,
> - employee integer references employees(id),
> - color varchar
> -)
> -}]
> +} ]
> }
>
> package TestApp::PhoneCollection;
> @@ -289,9 +259,6 @@
> return $tab;
> }
>
> -package TestApp::Color;
> -use base qw/Jifty::DBI::Record/;
> -
> package TestApp::Employee;
> use base qw/Jifty::DBI::Record/;
>
> @@ -300,7 +267,6 @@
> use Jifty::DBI::Record schema {
> column name => type is 'varchar';
> column phones => references TestApp::PhoneCollection by 'employee';
> - column favorite_color => references TestApp::Color by 'employee';
> }
> }
>
> @@ -321,19 +287,5 @@
> }
> }
>
> -package TestApp::Color;
> -
> -BEGIN {
> - use Jifty::DBI::Schema;
> - use Jifty::DBI::Record schema{
> - column employee => references TestApp::Employee;
> - column color =>
> - type is 'varchar',
> - valid_values are qw/
> - white cyan magenta
> - yellow green red black
> - /; # don't like CGA? too bad
> - }
> -}
>
> 1;
> _______________________________________________
> Jifty-commit mailing list
> Jifty-commit at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-commit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.bestpractical.com/pipermail/jifty-devel/attachments/20070816/2800204d/attachment-0001.htm
More information about the jifty-devel
mailing list