Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #16994

Re: Class 'Model' not found

From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Newsgroups comp.lang.php
Subject Re: Class 'Model' not found
Date 2016-08-30 14:41 +0200
Organization PointedEars Software (PES)
Message-ID <1619437.tdWV9SEqCh@PointedEars.de> (permalink)
References (6 earlier) <2827421.aeNJFYEL58@PointedEars.de> <87poottuey.fsf@ahungry.com> <npum3p$d8e$1@jstuckle.eternal-september.org> <4222356.31r3eYUQgx@PointedEars.de> <nq3rdg$gih$1@jstuckle.eternal-september.org>

Show all headers | View raw


Jerry Stuckle wrote:

> On 8/30/2016 5:39 AM, the troll Thomas 'Pointed Head' Lahn wrote:
>> Jerry Stuckle wrote:
>>> On 8/28/2016 12:00 AM, Matthew Carter wrote:
>>>> Thomas 'PointedEars' Lahn <PointedEars@web.de> writes:
>>>>> IOW, the problems that you are presuming simply *do* *not* *exist*.
>>>> Great explanation, a wonderful reference for anyone needing to
>>>> understand these topics better.
>>> And it solves no problem.
>> 
>> It solves the problem that dependencies have to be resolved manually,
>> which was the problem of the OP.
>> 
>>> These problems *do exist* in real life.
>> Only to the incompetent.
> 
> It doesn't solve the problem of multiple classes with the same name.

That was _not_ the problem of the OP.  It was an unfounded assumption by 
“J.O. Aho” who did not read the OP carefully, too.  The OP got

| Fatal error: Class 'Model' not found in /var/www/index.php on line 12

(which arguably should have been posted as plain text instead of a URL of an 
image)

for

  $class = new Model();

So the include must have been wrong.  Had an autoloader been used (or maybe 
it had, but incorrectly; who knows), an include would not have been 
necessary, the file path would have not mattered, the include would not have 
failed, and the class could have been loaded.  *IOW, dependencies would not 
have had to be resolved manually, with the potential of failure.*

> It's all too easy to load the wrong class.

AISB, this is only a problem for the incompetent.

One simply does not have *multiple* classes with the *same* name in the 
*same* namespace loaded in the *same* program/application, because *PHP does 
not allow it* – autoloader or not.  Because of this, one also simply does 
not have *multiple* classes with the *same* name in the *same* directory to 
begin with.  Where multiple versions are available, they are supposed to be 
in different directories or different namespaces, and in different revisions 
of a VCS, to be checked out on an as-needed basis (as Matthew already 
indicated).

Only the *utterly incompetent* would do otherwise.

And if one uses an autoloader for loading classes (which one should), the 
problem disappears in a puff of program logic by choosing the right one, by 
not choosing more than one, or – this is up to the class author; again, a 
matter of competence – to register the autoloader in such a way that there 
is no namespace conflict (as I explained before).

Please stop wasting our precious time by projecting your incompetence.

-- 
PointedEars
Zend Certified PHP Engineer 
<http://www.zend.com/en/yellow-pages/ZEND024953> | Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Class 'Model' not found M desinger <info.nez@gmail.com> - 2016-08-21 07:35 -0700
  Re: Class 'Model' not found M desinger <info.nez@gmail.com> - 2016-08-21 07:36 -0700
  Re: Class 'Model' not found M desinger <info.nez@gmail.com> - 2016-08-21 07:43 -0700
    Re: Class 'Model' not found "J.O. Aho" <user@example.net> - 2016-08-21 18:08 +0200
      Re: Class 'Model' not found "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-08-21 19:36 +0200
    Re: Class 'Model' not found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-22 20:56 +0200
      Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-22 19:08 -0400
        Re: Class 'Model' not found Matthew Carter <m@ahungry.com> - 2016-08-23 01:23 -0400
          Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-23 08:07 -0400
            Re: Class 'Model' not found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-27 14:26 +0200
              Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-27 10:13 -0400
                Re: Class 'Model' not found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-28 02:12 +0200
                Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-27 20:32 -0400
              Re: Class 'Model' not found Matthew Carter <m@ahungry.com> - 2016-08-28 00:00 -0400
                Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-28 08:40 -0400
                Re: Class 'Model' not found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-30 11:39 +0200
                Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-30 07:41 -0400
                Re: Class 'Model' not found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-30 14:41 +0200
                Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-30 09:02 -0400
                Re: Class 'Model' not found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-30 15:36 +0200
                Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-30 10:39 -0400
                Re: Class 'Model' not found Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2016-08-30 11:35 +0200
  Re: Class 'Model' not found M desinger <info.nez@gmail.com> - 2016-08-30 14:25 -0700
    Re: Class 'Model' not found Gregor Kofler <usenet@gregorkofler.com> - 2016-08-31 00:35 +0200
      Re: Class 'Model' not found M desinger <info.nez@gmail.com> - 2016-08-30 16:34 -0700
        Re: Class 'Model' not found Jerry Stuckle <jstucklex@attglobal.net> - 2016-08-30 19:58 -0400

csiph-web