[TYPO3-dev] new DOMDocument error

Jost Baron jost.baron at gmx.de
Tue Aug 12 20:05:53 CEST 2014


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sorry for the german language; again in english:

The problem is that the class is searched for in the namespace
"XXX\YYYYYYYYY\Controller", probably because the directive

namespace XXX\YYYYYYYYY\Controller;

is in the file. But the class DOMDocument is in the root namespace, so
you have to use that when instantiating a DOMDocument, with

$dom = new \DOMDocument("1.0");

Regards,
Jost

On 08/12/2014 07:24 PM, Jost Baron wrote:
> Hi Nikola,
> 
> das Problem ist, dass die Klasse DOMDocument im namespace 
> XXX\YYYYYYYYY\Controller gesucht wird, wahrscheinlich weil du die 
> Direktive
> 
> namespace XXX\YYYYYYYYY\Controller;
> 
> in der fraglichen Datei hast. Die Klasse liegt aber im
> Root-Namespace, den musst du bei der Instanziierung angeben. D.h.
> mit folgender Zeile sollte es klappen:
> 
> $dom = new \DOMDocument("1.0");
> 
> Gruß Jost
> 
> On 08/12/2014 07:01 PM, Nikola Vignjevic wrote:
>> Hi folks,
> 
>> I just try my first steps in MVC Extension development and have 
>> already a problem.
> 
>> the simple Line:
> 
>> $dom = new DOMDocument("1.0");
> 
>> throws a Error:
> 
>> Fatal error: Class 'XXX\YYYYYYYYY\Controller\DOMDocument' not
>> found in 
>> /var/www/virtual/test.de/my_domain/htdocs/typo3conf/ext/xxx_yyyyyyyy/Classes/Controller/CentralController.php
>
>> 
> 
> on line 118
> 
>> If I try the same line without typo3, everything is fine, and I 
>> didn't write:
> 
>> $dom = new XXX\YYYYYYYYY\Controller\DOMDocument();
> 
>> So why he is looking there? It actually have to be a simple part
>> of PHP and not part of typo3 MVC or so. Where is my mistake?
> 
>> Please a little hint..
> 
>> Nik
> 
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iEYEARECAAYFAlPqV4AACgkQNme/yCvmvTJ87gCbBFO3yQZfB8cHwbBijs7EmNXC
OosAnjKhqCo/TO7s9llxXo5uQ58wSKkX
=0gdJ
-----END PGP SIGNATURE-----



More information about the TYPO3-dev mailing list