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

TOPIC:

[FIXED] save function: a bug?! 04 Jun 2012 15:26 #2477

Hi Admin,

on the save function in th MODEL:
	function save($data)
	{

		$row = $this->getTable();



		//Convert data from a stdClass
		if (get_class($data) == 'stdClass')
			$data = JArrayHelper::fromObject($data);

		//Current id if unspecified
		if ($data['id'] != null)
			$id = $data['id'];
		else if (($this->_id != null) && ($this->_id > 0))
			$id = $this->_id;

and more specific on the line:
if (get_class($data) == 'stdClass')

sometimes I get this error:

Warning: get_class() expects parameter 1 to be object, array given in ROOT\administrator\components\MYCOMPONENT\models\ITEM.php on line 233

I solved it in this way:
		if (is_object($data)) {
			//Convert data from a stdClass
			if (get_class($data) == 'stdClass')
				$data = JArrayHelper::fromObject($data);
		}

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

Last edit: by admin.

Re: save function: a bug?! 07 Jun 2012 05:30 #2496

  • liubov
  • liubov's Avatar
  • Offline
  • Elite Member
  • Elite Member
  • (=) 10 mn and it's ready!
  • Posts: 279
  • Thank you received: 36
I 've never got error with save function, and have 7 different controllers ...
You have generate for 2.5 ?

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

Re: save function: a bug?! 07 Jun 2012 10:00 #2501

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Will be solved in Cook 2.0
Coding is now a piece of cake

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

Re: save function: a bug?! 26 Jun 2012 11:21 #2678

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Administrator
  • Chef
  • Posts: 3711
  • Thank you received: 986
Already fixed.
Coding is now a piece of cake

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

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

Les générateurs de code je les connais presque tous pour les avoir essorés en long en large et en travers ... mais celui ci c'est vraiment un outil formidable de simplicité et d'efficacité !
Marc. (liubov - Forum)

Get Started