/** Generate the SQL to write a relationship to the DB **/ public static function sqlDelete($relationship) { $relname = TLO::transClassTable($relationship); $location_class = $relationship::relationMany(); $relation_class = $relationship::relationOne(); $location_name = TLO::transClassTable($location_class); $query = new TLOQuery(); $query->update($location_name); foreach (TLO::keyNames($relation_class) as $key) { $query->set('%s = NULL', TLO::developedColName($relname, 'key', $key)); } TLO::concreteClassLoop($relationship, __CLASS__, function ($class) use($relname, $query) { TLO::propertyLoop($class, __CLASS__, function ($p) use($relname, $query) { $query->set('%s = NULL', TLO::developedColName($relname, 'var', $p), $p); }); }); TLO::whereKeys($query, $location_class); return $query; }
public function testReadSpecifiedItems() { $query = new TLOQuery(); $query->where('parent__key__id = ?'); $r = TLO::getObjects($this->db, 'Test3', $query, array($this->guid2)); $this->assertIsA($r, 'TLOObjectResult'); $this->assertIsA($r->fetch(), 'Test3'); $this->assertFalse($r->fetch()); }