XAMPP: Call to undefined Method

Discuss installing Symfony 2 here

Moderators: dcobalt, tiagojsag

XAMPP: Call to undefined Method

Postby Nimmermehr » Tue Apr 10, 2012 10:28 am

Hello,

I'm trying to learn Symfony since a few days and doing some tutorials. Now I'm doing a tutorial for setting up a database with doctrine and I just copied the code, but it won't work.

This is the code, where my Databasecontent should be defined:
//databasecontent.php
require_once __DIR__.'/app/bootstrap.php.cache';
require_once __DIR__.'/app/AppKernel.php';

use Symfony\Component\HttpFoundation\Request;

$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$kernel->boot();

$container = $kernel->getContainer();
$container->enterScope("request");
$container->set('request', Request::createFromGobals());
//...//

Now the tutorial says I should execute this file in the shell.
I type php /pathofproject/databasecontent.php in the shell but it always says "Fatal error: Call to undefined method Symfony\Component\HttpFoundation\Request::createFromGlobals() in C:/pathofxampp/Pathofproject/databasecontent.php

I'm working with Win 7, PHPEd 7.0, Symfony 2.0.12 and XAMPP 1.7.7.

Thank you for your help!
Nimmermehr
Junior Member
 
Posts: 2
Joined: Tue Apr 10, 2012 10:21 am

Re: XAMPP: Call to undefined Method

Postby danielh » Fri May 04, 2012 4:19 pm

That code you've copied seems a bit strange to me because it seems to be creating a web request which in the command line environment, doesn't really make sense. You might need it for your particular config though. Try removing the following 2 lines and see if you can run the code you need:

Code: Select all
$container->enterScope("request");
$container->set('request', Request::createFromGobals());


Having said that, your particular problem in this case might be the spelling of "Gobals" (missing the l after G)
danielh
Member
 
Posts: 49
Joined: Tue Dec 11, 2007 6:09 am
Location: Australia


Return to Installation and setup

Who is online

Users browsing this forum: No registered users and 2 guests