Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Static model instance variables?
  • Hi! I'm having some trouble with instance variables in my models combined with static functions. Basically what I would like to do is something like
    class Model_Foo extends Orm\Model {
    
      private/protected/public static $foo = 42;
    
      public static function equal_to_foo($n)
      {
          return $n == Model_Foo::foo;
      }
    
    }
    

    However I cant call
    Model_Foo::foo;
    
    without getting an unknown class variable error. So I'm just wondering what the correct/preferred way of declaring/getting static instance variables in a model
  • Jelmer Schreuder wrote on Monday 3rd of October 2011:
    That's a pretty basic mistake...[/url]

    Yeah, ofc. I forgot the $ infront of the variable name, a classic mistake...

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion