This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » legacy support » symfony 1.2 » Strict Standards: Non-static method error
Strict Standards: Non-static method error [message #98022] Mon, 26 April 2010 01:10 Go to next message
smugford  is currently offline smugford
Messages: 99
Registered: November 2009
Member
action code
public function getWhoisLoggedIn() {
		// check to see if the user is in a transaction for this item already
		return Doctrine_Query::create()
			->select('COUNT(DISTINCT s.user_id) AS users_online')
			->from('UserSessions s')
			->execute(array(), Doctrine::HYDRATE_ARRAY);
	}

Strict Standards: Non-static method UserSessions::getWhoisLoggedIn() should not be called statically, assuming $this from incompatible context in /var/www/xyz.../actions.class.php on line 32 


I get this error in a few places when i'm calling model functions from the controller.

Any ideas on why this happens? I know i can just turn the errors off but that's not a real solution.

Thanks.
Re: Strict Standards: Non-static method error [message #98033 is a reply to message #98022 ] Mon, 26 April 2010 07:08 Go to previous messageGo to next message
cokker  is currently offline cokker
Messages: 582
Registered: January 2007
Location: Germany
Faithful Member
please post the calls to this method. (Perhaps the mentioned actions.class.php)

greets
Sven

Re: Strict Standards: Non-static method error [message #98065 is a reply to message #98033 ] Mon, 26 April 2010 17:36 Go to previous messageGo to next message
smugford  is currently offline smugford
Messages: 99
Registered: November 2009
Member
no problem...

$this->whoisLoggedIn = UserSessions::getWhoisLoggedIn();
Re: Strict Standards: Non-static method error [message #98090 is a reply to message #98022 ] Tue, 27 April 2010 07:30 Go to previous messageGo to next message
cokker  is currently offline cokker
Messages: 582
Registered: January 2007
Location: Germany
Faithful Member
Is UserSessions a Peer class in your model? If so just change your method declaration as follows:

public static function getWhoisLoggedIn() {... }


Alternatively you may create an object before calling the method.
In your actions.class.php:
$sessions = new UserSessions();
$this->whoisLoggedIn = $sessions->getWhoisLoggedIn();


greets
Sven
Re: Strict Standards: Non-static method error [message #98167 is a reply to message #98090 ] Tue, 27 April 2010 18:50 Go to previous message
smugford  is currently offline smugford
Messages: 99
Registered: November 2009
Member
thank you!
Previous Topic:Help with csDoctrineActAsSortablePlugin
Next Topic:Problem with the new form system (form in form and ajax)
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software