public function getVirtualFields() { $fields = parent::getVirtualFields(); foreach ($fields as $k => $v) { if ($v == 'SubsiteID') { unset($fields[$k]); } } foreach (self::$db as $field => $type) { if (in_array($field, $fields)) { unset($fields[array_search($field, $fields)]); } } return $fields; }
public function testGetVirtualFields() { // Needs association with an original, otherwise will just return the "base" virtual fields $page = new VirtualPageTest_ClassA(); $page->write(); $virtual = new VirtualPage(); $virtual->CopyContentFromID = $page->ID; $virtual->write(); $this->assertContains('MyVirtualField', $virtual->getVirtualFields()); $this->assertNotContains('MyNonVirtualField', $virtual->getVirtualFields()); $this->assertNotContains('MyInitiallyCopiedField', $virtual->getVirtualFields()); }