private function findFieldsInTableSpec($fieldName, $spec)
    {
        $fields = [];
        if(is_array($spec) && !empty($spec))
        {
            if(array_key_exists($fieldName, $spec))
            {
                $fields = $spec[$fieldName];
            }

            if(isset($spec['joins']))
            {
                foreach($spec['joins'] as $join)
                {
                    $fields = array_merge($fields, $this->findFieldsInTableSpec($fieldName, $join));
                }
            }
        }
        return $fields;
    }
private function findFieldsInTableSpec($fieldName, $spec)
    {
        $fields = [];
        if(is_array($spec) && !empty($spec))
        {
            if(array_key_exists($fieldName, $spec))
            {
                $fields = $spec[$fieldName];
            }

            if(isset($spec['joins']))
            {
                foreach($spec['joins'] as $join)
                {
                    $fields = array_merge($fields, $this->findFieldsInTableSpec($fieldName, $join));
                }
            }
        }
        return $fields;
    }
private function findFieldsInTableSpec ( $ fieldName , $ spec ) { $ fields = [ ] ; if ( is_array ( $ spec ) && ! empty ( $ spec ) ) { if ( array_key_exists ( $ fieldName , $ spec ) ) { $ fields = $ spec [ $ fieldName ] ; } if ( isset ( $ spec [ 'joins' ] ) ) { foreach ( $ spec [ 'joins' ] as $ join ) { $ fields = array_merge ( $ fields , $ this -> findFieldsInTableSpec ( $ fieldName , $ join ) ) ; } } } return $ fields ; }
Finds fields in a table specification
@param string $fieldName
@param array $spec, a part of space ot complete spec
@return array
Finds fields in a table specification