annotate lib/IMPL/ORM/Schema/Relation/HasOne.pm @ 408:5c80e33f1218 ref20150831

added 'coarsen' function
author cin
date Mon, 07 Sep 2015 01:35:25 +0300
parents c6e90e02dd17
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
1 package IMPL::ORM::Schema::Relation::HasOne;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
2 use strict;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
3 use warnings;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
4
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
5 use parent qw(IMPL::ORM::Schema::Relation);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
6 use IMPL::Class::Property;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
7
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
8 BEGIN {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
9 public property target => prop_get | owner_set;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
10 public property name => prop_get | owner_set;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
11 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
12
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
13 our %CTOR = (
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
14 'IMPL::ORM::Schema::Relation' => sub { 'HasOne' }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
15 );
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
16
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
17 sub CTOR {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
18 my ($this,$name,$target) = @_;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
19 $this->name($name) or die new IMPL::InvalidArgumentException('A name is required for this relation');
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
20 $this->target($target) or die new IMPL::InvalidArgumentException('A target is required for this relation',$name);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
21 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
22
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
23 sub canHaveChildren {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
24 0;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
25 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
26
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
27
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
28 1;