annotate Lib/IMPL/ORM/Schema/Relation/HasOne.pm @ 117:0475eb382085

Controls support (RC1)
author wizard
date Thu, 03 Jun 2010 02:41:44 +0400
parents 16ada169ca75
children 4267a2ac3d46
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
1 package IMPL::ORM::Schema::Relation::HasOne;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
3 use warnings;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
4
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
5 use base qw(IMPL::ORM::Schema::Relation);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
6 use IMPL::Class::Property;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
7
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
8 BEGIN {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
9 public property target => prop_get | owner_set;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
10 public property name => prop_get | owner_set;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
11 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
12
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
13 our %CTOR = (
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
14 'IMPL::ORM::Schema::Relation' => sub { 'HasOne' }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
15 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
16
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
17 sub CTOR {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
18 my ($this,$name,$target) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
19 $this->name($name) or die new IMPL::InvalidArgumentException('A name is required for this relation');
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
20 $this->target($target) or die new IMPL::InvalidArgumentException('A target is required for this relation',$name);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
21 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
22
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
23 sub canHaveChildren {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
24 0;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
25 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
26
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
27
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 28
diff changeset
28 1;