Hi,

Am Montag, den 19.11.2007, 10:52 +0100 schrieb Hodicska Gergely:
[...]
> I think the *behavior* of the two code blocks is confusing. And I 
> *understand* that it can be stated in the manual that it works in this 
> way, but *maybe* not this is the best solution.

Why not something like this to fit both needs (I can think on scenarios
for both):

class ActiveRecord {
    public static function find($id)
    {
        echo get_called_class() . "\n";
    }
}

class Something extends ActiveRecord {
    public static function find($id)
    {
        return parent::find($id);
    }
}

class ActiveRecord2 {
        sensitive public static function find($id)
        {
                echo get_called_class() . "\n";
        }
}

class Something2 extends ActiveRecord {
        public static function find($id)
        {
                return parent::find($id);
        }
}

class Another extends Something2 {
        public static function find($id)
        {
                return parent::find($id);
        }
}

ActiveRecord::find(1);  // "ActiveRecord"
Something::find(2);     // "ActiveRecord"
ActiveRecord2::find(2); // "ActiveRecord2"
Something2::find(1);    // "Something2" => parent method is sensitive
Another::find(1);       // "Something2" => parent method is not sensitive

cu, Lars
-- 
  »Die Glorifizierung der prächtigen underdogs läuft auf
   die des prächtigen Systems heraus, das sie dazu macht.«
     -- Theodor W. Adorno, »Minima Moralia«: They, the people

Lars Strojny
Nießenstr. 36
51003 Cologne
Jabber/Mail: [EMAIL PROTECTED]
Weblog: http://usrportage.de

Attachment: signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil

Reply via email to