Overview

Namespaces

  • Alchemy
    • core
      • query
      • schema
    • dialect
    • engine
    • orm
    • tests
    • util
      • promise
  • PHP

Classes

  • DataMapper
  • DDL
  • ManyToOne
  • OneToMany
  • OneToOne
  • ORMQuery
  • ORMTable
  • ORMTableRef
  • RelatedSet
  • Relationship
  • Session
  • SessionSelect
  • WorkQueue
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: namespace  Alchemy\orm;
 4: 
 5: 
 6: /**
 7:  * Defines a OneToMany relationship. This is the parent side of a
 8:  * standard foreign key system.
 9:  */
10: class OneToMany extends Relationship {
11: 
12:     public function getRemoteColumnMap($origin) {
13:         $map = array_flip($this->getForeignKey()->getNameMap());
14: 
15:         foreach ($map as $remote => &$local) {
16:             $local = $origin->{$local};
17:         }
18: 
19:         return $map;
20:     }
21: 
22: 
23:     public function add($origin, $child) {
24:         $this->assertDestinationType($child);
25: 
26:         return $origin->cascadeForeignKey($child, $this);
27:     }
28: }
29: 
API documentation generated by ApiGen 2.8.0