예제 #1
0
 /**
  * @param Schema\Field $definition Raw field definition
  * @param string       $path       Relative field path
  * @return mixed
  * @throws \InvalidArgumentException
  */
 private function createFieldHierarchyRecursive(Schema\Field $definition, $path)
 {
     if (!preg_match('/^(?P<name>[^\\.]+)(\\.(?P<sub>.+))?$/', $path, $matches)) {
         throw new \InvalidArgumentException(sprintf('Invalid field name "%s" definition', $definition->getName()));
     }
     $name = ctype_digit($matches['name']) ? "array" : $matches['name'];
     if (isset($matches['sub'])) {
         $definition = $this->createFieldHierarchyRecursive($definition, $matches['sub']);
     } else {
         $definition = ["field" => $definition];
     }
     return [$name => $definition];
 }