public function __construct($title = null)
 {
     parent::__construct(uniqid('image_'), ' ', 1);
     $this->add_style('text-align', 'center');
     $this->_title = $title ? $title : \ZPHP\String::get('image');
     $this->_render_function = array($this, '_row_render_function');
 }
 protected function _get_input_html(array $params = array())
 {
     $attrs_html = self::_get_attr_html($params);
     $input_html = "<{$this->_tagname}{$attrs_html}>";
     if ($this->get_default_option_enabled()) {
         $option_text = $this->get_default_option_text() ? $this->get_default_option_text() : \ZPHP\String::get($this->get_optional() ? 'not_specified' : 'select');
         $input_html .= "<option value='" . \ZPHP\HTMLHelper::escape($this->get_default_option_value()) . "'>" . \ZPHP\HTMLHelper::escape($option_text) . "</option>";
         $input_html .= "<option value='" . \ZPHP\HTMLHelper::escape($this->get_default_option_value()) . "'></option>";
     }
     foreach ($this->_options as $option) {
         $option_tag = new HTMLLongTag('option', \ZPHP\HTMLHelper::escape($option['label']));
         $option_tag->set_param('value', \ZPHP\HTMLHelper::escape($option['value']));
         if (!is_null($this->get_value()) && $option['value'] == $this->get_value()) {
             $option_tag->set_param('selected', true);
         }
         $input_html .= $option_tag;
     }
     $input_html .= "</{$this->_tagname}>";
     return $input_html;
 }
Ejemplo n.º 3
0
 protected static function _get_trace_array($trace_string)
 {
     $ztrace = array();
     if ($count_matches = preg_match_all("#(?i)\\#\\d+\\s+(?P<file>.+?)\\((?P<line_number>.+?)\\)\\s*\\:\\s*(?P<code>.+)\n#", $trace_string, $stack_trace_matches, PREG_OFFSET_CAPTURE)) {
         $files = array();
         for ($i = 0; $i < $count_matches; $i++) {
             $ztrace[] = array('line' => $stack_trace_matches['line_number'][$i][0], 'code' => $stack_trace_matches['code'][$i][0], 'file' => $stack_trace_matches['file'][$i][0]);
         }
     }
     $trace = (array) $ztrace;
     $trace = array_reverse($trace);
     foreach (self::$_trace_void_first_rows_prefixs as $remove_first_rows_prefixs) {
         if (count($trace) < count($remove_first_rows_prefixs)) {
             continue;
         }
         $remove_trace_first_rows = true;
         $trace_index = 0;
         foreach ($remove_first_rows_prefixs as $test_code) {
             if (stripos(trim($trace[$trace_index]['code']), trim($test_code)) !== 0) {
                 $remove_trace_first_rows = false;
                 break;
             }
             $trace_index++;
         }
         if ($remove_trace_first_rows) {
             $trace = array_slice($trace, count($remove_first_rows_prefixs));
             break;
         }
     }
     $trace = array_slice($trace, 0, self::$_stack_max);
     if (!self::$_reverse_stack) {
         $trace = array_reverse($trace);
     }
     $app_dir = realpath(app_path() . '/..');
     foreach ($trace as $index => $str) {
         $trace[$index]['file'] = String::remove_prefix($str['file'], $app_dir);
     }
     return $trace;
 }
 protected function _get_input_html(array $params = array())
 {
     $title = $this->_get_title();
     $attrs_html = self::_get_attr_html($params);
     $input_html = "<{$this->_tagname}{$attrs_html}>";
     if ($this->get_default_option_enabled()) {
         $option_text = $this->get_default_option_text() ? $this->get_default_option_text() : \ZPHP\String::get($this->get_optional() ? 'not_specified' : 'select');
         $input_html .= "<option value='" . \ZPHP\HTMLHelper::escape($this->get_default_option_value()) . "'>" . \ZPHP\HTMLHelper::escape($option_text) . "</option>";
         $input_html .= "<option value='" . \ZPHP\HTMLHelper::escape($this->get_default_option_value()) . "'></option>";
     }
     foreach ($this->_options as $option) {
         $option_tag = new HTMLLongTag('option', \ZPHP\HTMLHelper::escape($option['label']));
         $option_tag->set_param('value', \ZPHP\HTMLHelper::escape($option['value']));
         if (!is_null($this->get_value()) && $option['value'] == $this->get_value()) {
             $option_tag->set_param('selected', true);
         }
         $input_html .= $option_tag;
     }
     $input_html .= "</{$this->_tagname}>";
     $js_id = \ZPHP\JSHelper::cast_str('#' . $this->_get_id());
     $js_container_class = \ZPHP\JSHelper::cast_str(self::$_SELECT2_CONTAINER_CLASS);
     $js_searching = \ZPHP\String::get_js('searching');
     $js_no_matches = \ZPHP\String::get_js('no_matches_found');
     $js_placeholder = $this->_get_title();
     if ((!array_key_exists('placeholder', $params) || !$params['placeholder']) && $this->get_use_title_label() && $title) {
         $js_placeholder = $title;
     }
     $js_placeholder = \ZPHP\JSHelper::cast_str($js_placeholder);
     $input_html .= "<script type='text/javascript'>\n\n\t\t\t\t//\$(document).ready(function () {\n\t\t\t\t\t\t\$({$js_id}).select2({\n\t\t\tcontainerCssClass: {$js_container_class},\n\t\t\tformatSearching: function() {\n\t\t\treturn {$js_searching};\n\t\t\t},\n\t\t\tformatNoMatches: function() {\n\t\t\treturn {$js_no_matches};\n\t\t\t},";
     if ($this->get_width()) {
         $input_html .= "width: " . \ZPHP\JSHelper::cast_str($this->get_width()) . ",";
     }
     $input_html .= "dropdownAutoWidth: true,\n\t\t\tminimumResultsForSearch: -1,\n\t\t\tescapeMarkup: function(s) { return s; },\n\t\t\tplaceholder: {$js_placeholder}\n\t\t\t});";
     /*$(<?=JSHelper::cast_str("#{$id}")?><!--).on('change', function() { --><?//=$tag_attrs['onchange']?><!-- });-->*/
     //		$input_html.= " }); ";
     $input_html .= "\n</script>";
     return $input_html;
 }
 protected function _get_input_html(array $params = array())
 {
     $title = $this->_get_title();
     $attrs_html = self::_get_attr_html($params);
     $html = "<{$this->_tagname}{$attrs_html} />";
     if ($this->get_value()) {
         $delete_checkbox = new HTMLInputCheckboxControl($this->get_name() . '_delete', \ZPHP\String::get('delete'));
         $delete_checkbox->onclick = '$(' . JSHelper::cast_str('#' . $this->get_name() . '_image') . ').toggleClass("todelete", $(this).attr("checked"))';
         $delete_checkbox->onclick = '$(this).parents(".input-image-container").find("img").toggleClass("todelete", $(this).attr("checked"))';
         $html .= '<br />';
         $html .= '<div class="input-image-container"> ';
         $html .= '<img src="' . HTMLHelper::escape($this->get_value()) . '" alt="Image" id="' . HTMLHelper::escape($this->get_name() . '_image') . '" class="' . HTMLHelper::escape(self::$_IMAGE_CLASS) . '" />';
         $html .= $delete_checkbox->to_string();
         $html .= '</div>';
         $html .= '<br />';
     } else {
         $delete_checkbox = new HTMLInputHiddenControl($this->get_name() . '_delete', '');
         $html .= '<div class="input-image-container"> ';
         $html .= $delete_checkbox->to_string();
         $html .= '</div>';
     }
     return $html;
 }
Ejemplo n.º 6
0
 /**
  *
  * @return $this
  *
  */
 public function add_cancel_button($text = null, array $attrs = array(), $class = '')
 {
     $button = new HTMLLongTag('button', $text ? $text : \ZPHP\String::get_html('cancel'));
     $button->update_params($attrs);
     $button->set_param('type', 'button');
     $button->add_class($class);
     $button->add_class(self::$_DEFAULT_BUTTON_CLASS);
     $button->add_class(self::$_DEFAULT_BUTTON_CANCEL_CLASS);
     $this->_buttons[] = $button;
     if (!$button->get_id()) {
         $button->set_random_id();
     }
     $this->_cancel_buttons[] = $button->get_id();
     return $this;
 }
 protected function _get_input_html(array $params = array())
 {
     if (isset($params['value'])) {
         unset($params['value']);
     }
     $title = $this->_get_title();
     if ((!array_key_exists('placeholder', $params) || !$params['placeholder']) && $this->get_use_title_label() && $title) {
         $params['placeholder'] = $title;
     }
     if ($this->_date_value) {
         $params['value'] = $this->_date_value->format($this->_date_format);
     }
     $style = '';
     if (isset($params['style'])) {
         $params['style'] = String::put_sufix($params['style'], ';') . $style;
     } else {
         $params['style'] = $style;
     }
     $params['style'] = "letter-spacing: 3px; {$params['style']}";
     $attrs_html = self::_get_attr_html($params);
     $datepicker_options = array_merge(array(), self::$_DEFAULT_DATEPICKER_OPTIONS);
     $datepicker_options['format'] = self::_datepicker_format($this->_date_format);
     $datepicker_options['clearBtn'] = $this->_clear_button;
     if ($this->_before_show_day) {
         $datepicker_options[JSHelper::get_avoid_cast_key('beforeShowDay')] = $this->_before_show_day;
     }
     if ($this->_before_show_month) {
         $datepicker_options[JSHelper::get_avoid_cast_key('beforeShowMonth')] = $this->_before_show_month;
     }
     if ($this->_start_date) {
         $datepicker_options['startDate'] = $this->_start_date->format(self::$_START_DATE_FORMAT);
     }
     if ($this->_end_date) {
         $datepicker_options['endDate'] = $this->_end_date->format(self::$_END_DATE_FORMAT);
     }
     $datepicker_options['language'] = 'es';
     $html = "<{$this->_tagname}{$attrs_html} />";
     $html .= new HTMLScriptTag("\$(" . JSHelper::cast_str('#' . $this->_get_id()) . ").datepicker(" . JSHelper::cast_obj($datepicker_options) . ");");
     $html .= new HTMLScriptTag("\$(" . JSHelper::cast_str('#' . $this->_get_id()) . ").mask(" . JSHelper::cast_str($this->_date_mask) . ");");
     return $html;
 }
 protected function _get_input_html(array $params = array())
 {
     $title = $this->_get_title();
     if ((!array_key_exists('placeholder', $params) || !$params['placeholder']) && $this->get_use_title_label() && $title) {
         $params['placeholder'] = $title;
     }
     $value = null;
     if (array_key_exists('value', $params)) {
         $value = self::parse_autocomplete_option($params['value']);
         if (!$value) {
             $value = array('id' => $params['value'], 'text' => '');
         }
         $params['value'] = $value['id'];
     }
     $attrs_html = self::_get_attr_html($params);
     $input_html = "<{$this->_tagname}{$attrs_html} />";
     $js_id = \ZPHP\JSHelper::cast_str('#' . $this->_get_id());
     $js_searching = \ZPHP\String::get_js('searching');
     $js_no_matches = \ZPHP\String::get_js('no_matches_found');
     $js_url = \ZPHP\JSHelper::cast_str($this->_request_url);
     $js_search_varname = \ZPHP\JSHelper::cast_str($this->_search_varname);
     $js_min_length = \ZPHP\JSHelper::cast_number($this->_min_length);
     $js_data = \ZPHP\JSHelper::cast_obj($this->_request_data);
     $js_method = \ZPHP\JSHelper::cast_str($this->_request_method);
     $js_placeholder = $this->_get_title();
     if ((!array_key_exists('placeholder', $params) || !$params['placeholder']) && $this->get_use_title_label() && $title) {
         $js_placeholder = $title;
     }
     $js_placeholder = \ZPHP\JSHelper::cast_str($js_placeholder);
     $js_window_id = \ZPHP\JSHelper::cast_str('#s2id_' . $this->_get_id());
     $html = "{$input_html}\n";
     $html .= "<script type='text/javascript'>\n";
     $html .= "if(!window[{$js_window_id}]) {\n\n\t\t\$({$js_id}).select2({formatSearching: function() {\n\t\t\treturn {$js_searching};\n\t\t\t},\n\t\t\tallowClear: " . JSHelper::cast_bool($this->_allow_clear) . ",\n\t\t\tformatNoMatches: function() {\n\t\t\treturn {$js_no_matches};\n\t\t\t},formatInputTooShort: function() {\n\t\t\t\treturn '';\n\t\t\t},\n\t\t\tescapeMarkup: function(s) { return s; },\n\t\t\tminimumInputLength: {$js_min_length},";
     if ($this->get_width()) {
         $html .= "width: " . \ZPHP\JSHelper::cast_str($this->get_width()) . ",";
     }
     $html .= "multiple: false,";
     if ($this->get_value()) {
         $html .= "placeholder: {$js_placeholder},";
     }
     $html .= "ajax: {\n\t\t\turl: {$js_url},\n\t\t\tdataType: 'json',\n\t\t\tdata: function(term, page)\n\t\t\t{\n\t\t\t\treturn \$.extend({}, { {$js_search_varname}: term}, {$js_data});\n\t\t\t},\n\t\t\tresults: function(data, page)\n\t\t\t{\n\t\t\t\treturn {results: data['rows']};\n\t\t\t}\n\t\t\t}\n\t\t";
     if ($value && is_array($value) && isset($value['id'])) {
         if (isset($value['text']) && $value['text']) {
             $html .= ", initSelection : function (element, callback) {\n\t\t\t\t\telement.val(" . \ZPHP\JSHelper::cast_str($value['id']) . ");\n\t\t\t\t\tcallback(" . \ZPHP\JSHelper::cast_obj($value) . ");\n\t\t\t\t}";
         } else {
             $html .= ", initSelection : function (element, callback) {\n\n\t\t\t\t\tvar ajaxData = {};\n\t\t\t\t\tajaxData[" . JSHelper::cast_str($this->_id_varname) . "] = " . JSHelper::cast_str($value['id']) . ";\n\n\t\t\t\t\t\$.ajax({\n\t\t\t\t\t\turl: {$js_url},\n\t\t\t\t\t\tdataType: 'json',\n\t\t\t\t\t\ttype: " . JSHelper::cast_str($this->_request_method) . ",\n\t\t\t\t\t\tdata: ajaxData,\n\t\t\t\t\t\tsuccess: function(data)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tvar row = null;\n\n\t\t\t\t\t\t\tif(data)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif(data['row'])\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\trow = data['row'];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\telse if(data['rows'])\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\trow = data['rows'][0];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif(row)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\telement.val(row['id']);\n\t\t\t\t\t\t\t\tcallback(row);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}";
         }
     }
     $html .= "});";
     $html .= "window[{$js_window_id}] = true; }";
     $html .= "\n</script>";
     return $html;
 }
Ejemplo n.º 9
0
 protected function _format_replace_callback($match)
 {
     switch ($match['letter']) {
         case 'Y':
             return $this->get_year();
             break;
         case 'y':
             return substr((string) $this->get_year(), 2);
             break;
         case 'm':
             return str_pad($this->get_month(), 2, '0', STR_PAD_LEFT);
             break;
         case 'd':
             return str_pad($this->get_day(), 2, '0', STR_PAD_LEFT);
             break;
         case 'H':
             return str_pad($this->get_hour(), 2, '0', STR_PAD_LEFT);
             break;
         case 'M':
             return str_pad($this->get_minutes(), 2, '0', STR_PAD_LEFT);
             break;
         case 'S':
             return str_pad($this->get_seconds(), 2, '0', STR_PAD_LEFT);
             break;
         case 'A':
             return $this->get_hour() >= 12 ? 'pm' : 'am';
             break;
         case 'K':
             $hour = $this->get_hour();
             if ($hour == 0) {
                 $hour = 12;
             } else {
                 if ($hour > 12) {
                     $hour = $hour - 12;
                 }
             }
             return str_pad($hour, 2, '0', STR_PAD_LEFT);
             break;
         case 'r':
             return mktime($this->get_hour(), $this->get_minutes(), $this->get_seconds(), $this->get_month(), $this->get_day(), $this->get_year());
             break;
         case 'O':
             return self::get_month_name_long($this->get_month());
             break;
         case 'o':
             return self::get_month_name_short($this->get_month());
             break;
         case 'W':
             return $this->get_day_of_week();
             break;
         case 'p':
             return self::get_day_name_short($this->get_day_of_week());
             break;
         case 'P':
             return self::get_day_name_long($this->get_day_of_week());
             break;
         case 'T':
             $days_diff = self::now()->diff_days($this);
             if (isset(self::$_days_diff_labels[$days_diff])) {
                 $key = self::$_language_text_prefix . self::$_days_diff_labels[$days_diff];
                 return String::get($key);
             } else {
                 return $this->format(self::get_default_format_date());
             }
             break;
         default:
             return '';
             break;
     }
 }
Ejemplo n.º 10
0
    public function to_string()
    {
        $prepared_rows = array();
        $prepared_columns = array();
        $array_rows = array();
        $has_checkbox_column = false;
        foreach ($this->_rows as $row) {
            $prepared_row = array();
            foreach ($this->_columns as $column) {
                $prepared_row[] = $column->call_row_render_function($row, $this);
            }
            $prepared_rows[] = $prepared_row;
            $array_rows[$this->get_row_id($row)] = $row;
        }
        foreach ($this->_columns as $column) {
            $prepared_column = array();
            $prepared_column['title'] = $column->call_header_render_function($this);
            $prepared_column['orderable'] = $column->get_orderable();
            $prepared_column['class'] = trim($column->get_class());
            $prepared_columns[] = $prepared_column;
            if (ClassHelper::is_instance_of($column, 'ZPHP\\HTML\\HTMLTableColumnCheckbox')) {
                $has_checkbox_column = true;
            }
        }
        $html = '';
        if (empty($this->_rows)) {
            $html = '<div class="panel panel-default datatable-empty">
				<div class="panel-body">
					' . $this->_empty_html . '
				</div>
			</div>';
        } else {
            $attrs_html = self::_get_attr_html($this->_params);
            $html = '

				<div id="' . HTMLHelper::escape('div_container_' . $this->id) . '" class="datatable-container">
					<table' . $attrs_html . '>
						<thead><tr>';
            foreach ($this->_columns as $column) {
                $html .= $column;
            }
            $data_table_params = array();
            $data_table_params['data'] = $prepared_rows;
            $data_table_params['columns'] = $prepared_columns;
            $data_table_params['paging'] = $this->_paging;
            $data_table_params['info'] = $this->_show_info;
            $data_table_params['ordering'] = $this->_ordering;
            $data_table_params['language'] = array();
            $data_table_params['language']['search'] = \ZPHP\String::get('datatables_search');
            $data_table_params['language']['lengthMenu'] = \ZPHP\String::get('datatables_length_menu');
            $data_table_params['language']['zeroRecords'] = \ZPHP\String::get('datatables_zero_records');
            $data_table_params['language']['info'] = \ZPHP\String::get('datatables_info');
            $data_table_params['language']['infoEmpty'] = \ZPHP\String::get('datatables_info_empty');
            $data_table_params['language']['infoFiltered'] = \ZPHP\String::get('datatables_info_filtered');
            $data_table_params['language']['loadingRecords'] = \ZPHP\String::get('datatables_loading_records');
            $data_table_params['language']['paginate'] = array();
            $data_table_params['language']['paginate']['first'] = \ZPHP\String::get('datatables_first');
            $data_table_params['language']['paginate']['last'] = \ZPHP\String::get('datatables_last');
            $data_table_params['language']['paginate']['last'] = \ZPHP\String::get('datatables_last');
            $data_table_params['language']['paginate']['next'] = \ZPHP\String::get('datatables_next');
            $data_table_params['language']['paginate']['previous'] = \ZPHP\String::get('datatables_previous');
            $html .= '

				</tr></thead>
						<tbody></tbody>
					</table>
				</div>
				<script type="text/javascript">
					(function() {
						var table = $(' . JSHelper::cast_str('#' . $this->id) . ');
						var dataTable = table.dataTable(' . JSHelper::cast_obj($data_table_params) . ');

						table.data("rowsData", ' . JSHelper::cast_obj($array_rows) . ');
						table.data("dataTable", dataTable);

						table.data("getRowData", function(id) {
							return table.data("rowsData")[id];
						});

						';
            foreach ($this->_columns as $column) {
                $html .= $column->call_load_render_function($this);
            }
            if ($has_checkbox_column) {
                $html .= 'table.data("getCheckedRows", function(field) {
							var checkedInputs = table.find("tbody tr input.checkbox:checked");
							var rowsData = [];
							checkedInputs.each(function(index, item)
							{
								var id = $(this).val();
								var rowData = table.data("getRowData")(id);

								if(field)
								{
									rowData = rowData[field];
								}

								rowsData.push(rowData);
							});

							return rowsData;
						});';
            }
            $html .= '	})();';
            $html .= "\n\t\t\t\$(document).ready(function() {\n\t\t\t\tvar table = \$(" . JSHelper::cast_str('#' . $this->id) . ");\n\t\t\t\ttable.parent().css({'min-height': table.height()});\n\n\t\t\t\tvar selects = \$('.dataTables_length select');\n\n\t\t\t\tselects.each(function() {\n\n\t\t\t\t\tif(\$(this).children().length == 0)\n\t\t\t\t\t{\n\t\t\t\t\t\t\$(this).parents('.dataTables_length').css({'visibility': 'hidden'});\n\t\t\t\t\t}\n\n\t\t\t\t});\n\t\t\t});\n\n\t\t\t";
            $html .= "</script>";
        }
        return $html;
    }
Ejemplo n.º 11
0
 protected static function _entities_create()
 {
     if (isset($_POST['tables']) && is_array($_POST['tables'])) {
         foreach ($_POST['tables'] as $table_name => $info) {
             $select_database = \DB::select(\DB::raw("SELECT DATABASE()"));
             $database = null;
             foreach ($select_database as $sdatabase) {
                 $database = $sdatabase->{"DATABASE()"};
                 break;
             }
             $entity_name = $info['entity'];
             $repository_name = $info['repository'];
             $repository_database_name = $info['repository_database'];
             $info_paths = self::_get_table_paths($table_name);
             $entity_path = dirname($info_paths['entity']['path']) . '/' . $entity_name . '.php';
             $repository_path = dirname($info_paths['repository']['path']) . '/' . $repository_name . '.php';
             $repository_database_path = dirname($info_paths['repository_database']['path']) . '/' . $repository_database_name . '.php';
             $describe_tables = \DB::select(\DB::raw("DESCRIBE `" . $table_name . "`"));
             $get_keys = array();
             $primary_key = array();
             $columns_keys = array();
             $create_keys = array();
             foreach ($describe_tables as $column_info) {
                 $columns_keys[] = $column_info->Field;
                 if ($column_info->Key) {
                     $column_key = strtoupper($column_info->Key);
                     if ($column_key == 'PRI') {
                         $primary_key[] = $column_info->Field;
                     } else {
                         if ($column_key == 'UNI') {
                             $get_keys[] = [$column_info->Field];
                         }
                     }
                 }
                 if ((!$column_info->Extra || strtolower($column_info->Extra) != 'auto_increment') && !in_array($column_info->Field, self::$_avoid_create_columns)) {
                     $create_keys[] = $column_info->Field;
                 }
             }
             if (!empty($primary_key)) {
                 $get_keys[] = $primary_key;
             }
             $foreign_keys_get = [];
             $foreign_keys_list = [];
             $describe_foreign_keys_get = \DB::select(\DB::raw("SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = " . String::quote_sql($table_name) . " AND TABLE_SCHEMA = " . String::quote_sql($database) . ";"));
             foreach ($describe_foreign_keys_get as $info) {
                 if (!is_null($info->REFERENCED_TABLE_NAME)) {
                     $foreign_key_info = [];
                     $foreign_key_info['foreign_table'] = $info->REFERENCED_TABLE_NAME;
                     $foreign_key_info['foreign_key'] = $info->REFERENCED_COLUMN_NAME;
                     $foreign_key_info['self_key'] = $info->COLUMN_NAME;
                     $referenced_info_paths = self::_get_table_paths($info->REFERENCED_TABLE_NAME);
                     $foreign_key_info['table'] = self::_table_to_singular($info->REFERENCED_TABLE_NAME);
                     $foreign_key_info['entity'] = $namespace = '\\' . self::_path_to_namespace(dirname($referenced_info_paths['entity']['path']) . '/' . $referenced_info_paths['entity']['name'] . '.php') . '\\' . $referenced_info_paths['entity']['name'];
                     $foreign_keys_get[] = $foreign_key_info;
                 }
             }
             $describe_foreign_keys_list = \DB::select(\DB::raw("SELECT * FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE REFERENCED_TABLE_NAME = " . String::quote_sql($table_name) . " AND TABLE_SCHEMA = " . String::quote_sql($database) . ";"));
             foreach ($describe_foreign_keys_list as $info) {
                 if (!is_null($info->REFERENCED_TABLE_NAME)) {
                     $foreign_key_info = [];
                     $foreign_key_info['foreign_table'] = $info->TABLE_NAME;
                     $foreign_key_info['foreign_key'] = $info->COLUMN_NAME;
                     $foreign_key_info['self_key'] = $info->REFERENCED_COLUMN_NAME;
                     $referenced_info_paths = self::_get_table_paths($info->TABLE_NAME);
                     $foreign_key_info['table'] = self::_table_to_singular($info->TABLE_NAME);
                     $foreign_key_info['list_method'] = 'list_' . $info->TABLE_NAME;
                     $foreign_key_info['entity'] = $namespace = '\\' . self::_path_to_namespace(dirname($referenced_info_paths['entity']['path']) . '/' . $referenced_info_paths['entity']['name'] . '.php') . '\\' . $referenced_info_paths['entity']['name'];
                     $foreign_keys_list[] = $foreign_key_info;
                 }
             }
             //				\ZPHP\VariableHelper::var_export_html($table_name);
             //				\ZPHP\VariableHelper::var_export_html($foreign_keys_get);
             //				\ZPHP\VariableHelper::var_export_html($foreign_keys_list);
             //				die();
             @mkdir(dirname($entity_path));
             @mkdir(dirname($repository_path));
             @mkdir(dirname($repository_database_path));
             self::_generate_entity($table_name, $entity_name, $entity_path, $entity_namespace, $foreign_keys_get, $foreign_keys_list);
             self::_generate_repository($table_name, '\\' . $entity_namespace . '\\' . $entity_name, $repository_name, $repository_path, $namespace, $repository_database_name, $get_keys, $create_keys);
             self::_generate_repository_database($table_name, '\\' . $entity_namespace . '\\' . $entity_name, $repository_database_name, $repository_database_path, '\\' . $namespace . '\\' . $repository_name, $get_keys, $create_keys);
         }
     }
 }