function testCmp() { $mdr1 = Metadata_Reference::getOneFromDb(['metadata_reference_id' => 6301], $this->DB); $mdr2 = Metadata_Reference::getOneFromDb(['metadata_reference_id' => 6302], $this->DB); $this->assertEqual(-1, Metadata_Reference::cmp($mdr1, $mdr2)); $this->assertEqual(0, Metadata_Reference::cmp($mdr1, $mdr1)); $this->assertEqual(1, Metadata_Reference::cmp($mdr2, $mdr1)); $mdrs = Metadata_Reference::getAllFromDb([], $this->DB); usort($mdrs, 'Metadata_Reference::cmp'); // util_prePrintR($mdrs); $this->assertEqual(6301, $mdrs[0]->metadata_reference_id); $this->assertEqual(6302, $mdrs[1]->metadata_reference_id); $this->assertEqual(6307, $mdrs[2]->metadata_reference_id); $this->assertEqual(6306, $mdrs[3]->metadata_reference_id); $this->assertEqual(6305, $mdrs[4]->metadata_reference_id); $this->assertEqual(6304, $mdrs[5]->metadata_reference_id); $this->assertEqual(6303, $mdrs[6]->metadata_reference_id); }
public function loadReferences() { $this->references = Metadata_Reference::getAllFromDb(['metadata_type' => 'term_value', 'metadata_id' => $this->metadata_term_value_id, 'flag_delete' => FALSE], $this->dbConnection); usort($this->references, 'Metadata_Reference::cmp'); }
public function loadReferences() { $this->references = Metadata_Reference::getAllFromDb(['metadata_type' => 'structure', 'metadata_id' => $this->metadata_structure_id, 'flag_delete' => FALSE], $this->dbConnection); }