/** Update the appropriate line in the DB to NULLs and load it, returning that object **/ public static function newObject(PDO $db, $relationship, TLO $one, TLO $many) { $location_class = $relationship::relationMany(); $relation_class = $relationship::relationOne(); $query = self::sqlCreate($relationship); $params = array(); foreach ($one->getKeys($relation_class) as $key => $val) { $params[] = $val; } foreach ($many->getKeys($location_class) as $key => $val) { $params[] = $val; } $s = TLO::prepare($db, $query); TLO::execute($s, $params); return TLORelationship::getOne($db, $relationship, $many); }
public function testRelationshipResultIteration() { $t = TLO::getObject($this->db, 'Test3', array($this->guid2)); foreach (TLORelationship::getMany($this->db, 'ConnectedTo', $t) as $i => $o) { $this->assertNoPattern('/[^0-9]/', $i); $this->assertIsA($o, 'ConnectedTo'); $this->assertIsA($o->getRelation(), 'Test1'); } $this->assertEqual($i, 2); }