Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC:

fork table 11 Sep 2013 12:38 #11060

  • etc
  • etc's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 132
  • Thank you received: 19
Hello,

when I tried to fork a table from table folder in backend it gives me error
Fatal error: Call to a member function getTableColumns() on a non-object in /hosting/www/mydomain/libraries/joomla/table/table.php on line 188

So I had to change the origin.

Please Log in or Create an account to join the conversation.

fork table 11 Sep 2013 13:14 #11062

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Can you please explain better your fork.
Coding is now a piece of cake

Please Log in or Create an account to join the conversation.

fork table 11 Sep 2013 21:53 #11068

  • etc
  • etc's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
  • Posts: 132
  • Thank you received: 19
administrator/components/com_mtraining/tables/group.php
class MtrainingCkTableGroup extends MtrainingClassTable
{
	/**
	* Constructor
	*
	* @access	public
	* @param	object	&$db	Database connector object
	* @param	string	$tbl	Table name
	* @param	string	$key	Primary key
	* @return	void
	*/
	public function __construct(&$db, $tbl = '#__training_groups', $key = 'id')
	{
		parent::__construct($tbl, $key, $db);
	}


}

I put the code above to fork
administrator/components/com_mtraining/fork/tables/group.php
class MtrainingTableGroup extends MtrainingCkTableGroup
{
	/**
	* Constructor
	*
	* @access	public
	* @param	object	&$db	Database connector object
	* @param	string	$tbl	Table name
	* @param	string	$key	Primary key
	* @return	void
	*/
	public function __construct(&$db, $tbl = '#__training_groups', $key = 'id')
	{
		parent::__construct($tbl, $key, $db);
	}

}

I did not change anything in code in fork folder, just copy the origin. But does not work

Please Log in or Create an account to join the conversation.

fork table 19 Sep 2013 13:08 #11127

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
be careful with 'parent', 'self' keywords in forks.

parent of your fork is your original generated.
So, if you want to execute the original :
class MtrainingTableGroup extends MtrainingCkTableGroup
{
	/**
	* Constructor
	*/
	public function __construct(&$db, $tbl = '#__training_groups', $key = 'id')
	{
		parent::__construct($db, $tbl, $key);  //HERE declaration should be the same
	}

}

If you do not want :
class MtrainingTableGroup extends MtrainingCkTableGroup
{
	/**
	* Constructor
	*/
	public function __construct(&$db, $tbl = '#__training_groups', $key = 'id')
	{
		parent::parent::__construct($tbl, $key, $db);  //HERE call to the parent of original
	}

}

That's it.
Coding is now a piece of cake
The following user(s) said Thank You: etc

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Time to create page: 0.082 seconds

Awards for the best Joomla app. This product is gonna win an award for this amazing job. Cook Self Service is the the best application from all over the Joomla universe ! It brings Joomla to a professional level really advanced for developers. It is a real fun to develop with it. The ACL part and security checks implementation are just... so much hours saved. I can now concentrate myself more on the design part and the creative works. Thank you so much. Guys I offer you all my congratulation ! Keep up the works because Joomla is needing it to increase the quality of extensions availables on the JED. I also learned a lot because I can see how to code at the proper place and I found all my answers reading the forum.
lack_hanson (JED)
          

Get Started