예제 #1
0
 public function testGetAllFields()
 {
     HeraldField::getAllFields();
     $this->assertTrue(true);
 }
예제 #2
0
 private function getFieldImplementationMap()
 {
     if ($this->fieldMap === null) {
         // We can't use PhutilClassMapQuery here because field expansion
         // depends on the adapter and object.
         $object = $this->getObject();
         $map = array();
         $all = HeraldField::getAllFields();
         foreach ($all as $key => $field) {
             $field = id(clone $field)->setAdapter($this);
             if (!$field->supportsObject($object)) {
                 continue;
             }
             $subfields = $field->getFieldsForObject($object);
             foreach ($subfields as $subkey => $subfield) {
                 if (isset($map[$subkey])) {
                     throw new Exception(pht('Two HeraldFields (of classes "%s" and "%s") have the same ' . 'field key ("%s") after expansion for an object of class ' . '"%s" inside adapter "%s". Each field must have a unique ' . 'field key.', get_class($subfield), get_class($map[$subkey]), $subkey, get_class($object), get_class($this)));
                 }
                 $subfield = id(clone $subfield)->setAdapter($this);
                 $map[$subkey] = $subfield;
             }
         }
         $this->fieldMap = $map;
     }
     return $this->fieldMap;
 }