public function search()
    {
        // Explode path by dot
        $paths = explode('.', $this->getPath());

        // First we need to filter fields schema and find
        // field with slug of current dot path segment.
        $record = array_filter($this->getSchema(), function ($field) use ($paths) {
            return $field->getSlug() == $paths[0];
        });

        // Grab first item form
        // filtered schema record.
        $field = reset($record);

        // If current path segment is not last segment we need to search
        // futher in field childrens. Before making recusive call,
        // remove current segment path from global paths.
        if ($paths[0] !== end($paths)) {
            return $field->getChildren()->getWithPath(implode('.', array_slice($paths, 1)));
        }

        // If we have field we are done,
        // just return found field.
        if ($field) {
            return $field;
        }

        // We could not find field.
        // Throw an Exception.
        throw new FieldException("We couldn't find Field: ".$this->getPath());
    }
public function search()
    {
        // Explode path by dot
        $paths = explode('.', $this->getPath());

        // First we need to filter fields schema and find
        // field with slug of current dot path segment.
        $record = array_filter($this->getSchema(), function ($field) use ($paths) {
            return $field->getSlug() == $paths[0];
        });

        // Grab first item form
        // filtered schema record.
        $field = reset($record);

        // If current path segment is not last segment we need to search
        // futher in field childrens. Before making recusive call,
        // remove current segment path from global paths.
        if ($paths[0] !== end($paths)) {
            return $field->getChildren()->getWithPath(implode('.', array_slice($paths, 1)));
        }

        // If we have field we are done,
        // just return found field.
        if ($field) {
            return $field;
        }

        // We could not find field.
        // Throw an Exception.
        throw new FieldException("We couldn't find Field: ".$this->getPath());
    }
public function search ( ) { // Explode path by dot $ paths = explode ( '.' , $ this -> getPath ( ) ) ; // First we need to filter fields schema and find // field with slug of current dot path segment. $ record = array_filter ( $ this -> getSchema ( ) , function ( $ field ) use ( $ paths ) { return $ field -> getSlug ( ) == $ paths [ 0 ] ; } ) ; // Grab first item form // filtered schema record. $ field = reset ( $ record ) ; // If current path segment is not last segment we need to search // futher in field childrens. Before making recusive call, // remove current segment path from global paths. if ( $ paths [ 0 ] !== end ( $ paths ) ) { return $ field -> getChildren ( ) -> getWithPath ( implode ( '.' , array_slice ( $ paths , 1 ) ) ) ; } // If we have field we are done, // just return found field. if ( $ field ) { return $ field ; } // We could not find field. // Throw an Exception. throw new FieldException ( "We couldn't find Field: " . $ this -> getPath ( ) ) ; }
Search field in schema.

@throws \Assely\Field\FieldException

@return \Assely\Field\Field
Search field in schema .