Add Tables [migrations] แล้ว error ต้องแก้ตรงไหนค่ะ

พูดคุย phpBB3, SMF ปัญหา การติดตั้ง ปัญหา การลง Mod การแก้ไข หน้าตาบอร์ด การใช้งาน Joomla 1.5, 1.6, 1.7, 2.5 ,3.x รวมถึง Joomla 4 การใช้งาน wordpress และ CMS อื่นๆ
การตั้งคำถาม ควรระบุรุ่นที่ใช้ ในการตั้งคำตามด้วย นะ เช่น SMF 1.1.4 หรือ SMF2.0, OpenERP, Odoo และ รายละเอียดของ server OS, php เวอร์ชั่นไหน ฐานข้อมูลอะไร

Moderator: mindphp

กฎการใช้บอร์ด
คำถามหมวดนี้ ควรระบุ รายละเอียดของ Server OS, เวอร์ชั่น ของ PHP, CMS ที่ท่านใช้
รวมถึง Hosting หรือ Control Panel Hosting
M034
PHP Super Member
PHP Super Member
โพสต์: 258
ลงทะเบียนเมื่อ: 28/03/2016 10:21 am
ติดต่อ:

Add Tables [migrations] แล้ว error ต้องแก้ตรงไหนค่ะ

โพสต์ที่ยังไม่ได้อ่าน โดย M034 »

ขึ้นแบบนี้หน้า ACP เมื่อกดตั้งค่าใช้งาน extension
Selection_245.png
โค๊ด ไฟล์ install ใน migrations

โค้ด: เลือกทั้งหมด

<?php namespace myproject\m_kaset\migrations;

class install_m_kaset extends \phpbb\db\migration\migration
{
	public function effectively_installed()
	{
		return isset($this->config['m_kaset_version']) && version_compare($this->config['m_kaset'], '1.0.0','>=');
	}
	static public function depends_on()
	{
			return array('\phpbb\db\migration\data\v310\dev');
	}
			public  function  update_schema()
		{
	return array
		(
	'add_tables' => array(
		$this->table_prefix . 'm_plant' => array(
			    'COLUMNS' => array(
				'plant_id' =>array('UINT:11',null,'auto_increment'),
				'plant_name' =>array ('UINT:11',0),
				'plant_characteristics' =>array ('UNIT:11',0),
				'how_to' =>array('UNIT:11',0),
				'age' =>array('UNIT:11',0),
				'price'=>array('UNIT:11',0),
				'properties'=>array('UNIT:11',0),
				'user_add'=>array('UNIT:11',0),
				'time_add'=>array('UNIT:11',0),
				'user_edit'=>array('UNIT:11',0),
				'time_edit'=>array('UNIT:11',0),
				'detail'=>array('UNIT:11',0),
					),
    'PRIMARY_KEY' =>'plant_id',
						 ),
						 ),			    
		);
		}
public function revert_schema()
{
return array
	(
    'drop_tables' =>array(
	$this->table_prefix . 'm_plant',
	  ),
);
}
}
หน้า routing

โค้ด: เลือกทั้งหมด

myproject_plant_controller:
        path: /m_kaset/plant
        defaults: { _controller: myproject.m_kaset.plant:plant}
        requirements:
หน้า services

โค้ด: เลือกทั้งหมด

imports:
        - { resource: tables.yml }
services:
myproject.m_kaset.plant:
                class: myproject\m_kaset\controller\plant
                arguments:
                        - @config
                        - @dbal.conn
                        - @request
                        - @template
                        - @user
                        - @controller.helper
                        - %core.root_path%
                        - %core.php_ext%
                        - %tables.m_plant%

หน้า tables.yml

โค้ด: เลือกทั้งหมด

parameters:
        tables.m_plant: %core.table_prefix%m_plant
หน้า plant.php

โค้ด: เลือกทั้งหมด

<?php

namespace myproject\m_kaset\controller;

class plant {

	public function __construct(\phpbb\config\config $config, \phpbb\db\driver\driver_interface $db, 
		\phpbb\request\request $request, \phpbb\template\template $template, \phpbb\user $user, 
		\phpbb\controller\helper $helper, $root_path, $php_ext,$m_plant,$m_pest_has_plant,$m_pest,$m_fertilizer_has_plant,$m_fertilizer) {
		$this->config = $config;
		$this->db = $db;
		$this->request = $request;
		$this->template = $template;
		$this->user = $user;
		$this->helper = $helper;
		$this->root_path = $root_path;
		$this->php_ext = $php_ext;
		$this->m_plant =$m_plant;
		$this->m_pest_has_plant=$m_pest_has_plant;
		$this->m_pest=$m_pest;
		$this->m_fertilizer_has_plant=$m_fertilizer_has_plant;
		$this->m_fertilizer=$m_fertilizer;
		
	}

	public function plant() 
	{
		$page_title = $this->user->lang('plant');
		$this->template->assign_block_vars('navlinks', array(
		    'FORUM_NAME' => $page_title,
		    'U_VIEW_FORUM' => $this->helper->route('myproject_m_kaset_controller', array ('name' =>'myproject')),
		    ));
		
		        return $this->helper->render('plant.html', $this->user->lang('M_KASET'));
	}
}
?>
แก้ไขล่าสุดโดย M034 เมื่อ 22/04/2016 6:01 pm, แก้ไขไปแล้ว 1 ครั้ง.
ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

Re: Add Tables [migrations] แล้ว error ต้องแก้ตรงไหนค่ะ

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

UNIT ==> UINT

โค้ด: เลือกทั้งหมด

 'plant_name' => array('UINT:11', 0),

โค้ด: เลือกทั้งหมด

   'plant_characteristics' => array('UNIT:11', 0),
//                        'how_to' => array('UNIT:11', 0),
//                        'age' => array('UNIT:11', 0),
//                        'price' => array('UNIT:11', 0),
//                        'properties' => array('UNIT:11', 0),
//                        'user_add' => array('UNIT:11', 0),
//                        'time_add' => array('UNIT:11', 0),
//                        'user_edit' => array('UNIT:11', 0),
//                        'time_edit' => array('UNIT:11', 0),
//                        'detail' => array('UNIT:11', 0),  
M034
PHP Super Member
PHP Super Member
โพสต์: 258
ลงทะเบียนเมื่อ: 28/03/2016 10:21 am
ติดต่อ:

Re: Add Tables [migrations] แล้ว error ต้องแก้ตรงไหนค่ะ

โพสต์ที่ยังไม่ได้อ่าน โดย M034 »

แก้แล้วค่ะ แต่ตอนนี้ติดที่ลบ extension ในหน้า ACP -> customise ไม่ได้ค่ะ เป็นเพราะอะไรค่ะ
ภาพประจำตัวสมาชิก
thatsawan
PHP VIP Members
PHP VIP Members
โพสต์: 28508
ลงทะเบียนเมื่อ: 31/03/2014 10:02 am
ติดต่อ:

Re: Add Tables [migrations] แล้ว error ต้องแก้ตรงไหนค่ะ

โพสต์ที่ยังไม่ได้อ่าน โดย thatsawan »

ลองเช็คทีละบรรทัด คอมเม้น code เเต่ละช่วงดู เเล้ว ถอนการติดตั้ง เเละเปิดใช้งานดู
M034
PHP Super Member
PHP Super Member
โพสต์: 258
ลงทะเบียนเมื่อ: 28/03/2016 10:21 am
ติดต่อ:

Re: Add Tables [migrations] แล้ว error ต้องแก้ตรงไหนค่ะ

โพสต์ที่ยังไม่ได้อ่าน โดย M034 »

ได้แล้วค่ะ error เพราะไม่ได้เว้นวรรค เลยทำให้ error ในส่วนนี้
Jerrycix
PHP Newbie
PHP Newbie
โพสต์: 2
ลงทะเบียนเมื่อ: 06/06/2016 6:06 pm
ติดต่อ:

Re: Add Tables [migrations] แล้ว error ต้องแก้ตรงไหนค่ะ

โพสต์ที่ยังไม่ได้อ่าน โดย Jerrycix »

I agree with John that story was published, thoughtful dance now.
ตอบกลับโพส
  • Similar Topics
    ตอบกลับ
    แสดง
    โพสต์ล่าสุด

ผู้ใช้งานขณะนี้

สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 51