Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8023125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:28:44+00:00 2026-06-04T22:28:44+00:00

Missing something when declaring a DateTime object in PHP 5.3.8 I get a JSON

  • 0

Missing something when declaring a DateTime object in PHP 5.3.8

I get a JSON string with a determinate date time which is passed to my php controller.

For some reason, I am not getting it to be mapped as a DateTime object in php. But sort of weirdly. See the following images:

  1. As you can see in the Expressions Window (top right), BEFORE the step, I am checking that new DateTime(myVariable) is bringing and transforming correctly what I need. In the first watch, the variable to pass to DateTime constructor. In the second watch, the expression newDateTime(myVariable) already mapped as a DateTimeObject. Apparently fine up to here.

    enter image description here

  2. But, sadly, when I go forward and press F6, the following exemption (see also the image below) is thrown:

    Fatal error: Class 'Acme\StoreBundle\Repository\DateTime' not found in /Users/pgbonino/Sites/Symfony/src/Acme/StoreBundle/Repository/HistoryRepository.php on line 19
    
    Call Stack:
        0.0201     693568   1. {main}() /Users/pgbonino/Sites/Symfony/web/app_dev.php:0
        0.0267    2106576   2. Symfony\Component\HttpKernel\Kernel->handle(???, ???, ???) /Users/pgbonino/Sites/Symfony/web/app_dev.php:24
        0.0377    2649176   3. Symfony\Bundle\FrameworkBundle\HttpKernel->handle(???, ???, ???) /Users/pgbonino/Sites/Symfony/app/bootstrap.php.cache:547
        0.0378    2650832   4. Symfony\Component\HttpKernel\HttpKernel->handle(???, ???, ???) /Users/pgbonino/Sites/Symfony/app/cache/dev/classes.php:4879
        0.0378    2650832   5. Symfony\Component\HttpKernel\HttpKernel->handleRaw(???, ???) /Users/pgbonino/Sites/Symfony/app/cache/dev/classes.php:3875
        0.1574    5562232   6. call_user_func_array(???, ???) /Users/pgbonino/Sites/Symfony/app/cache/dev/classes.php:3905
        0.1574    5562600   7. Acme\StoreBundle\Controller\HistoryController->saveTestAction() /Users/pgbonino/Sites/Symfony/app/cache/dev/classes.php:3905
        0.1694    5739032   8. Acme\StoreBundle\Repository\HistoryRepository->saveTestInHistory(???, ???) /Users/pgbonino/Sites/Symfony/src/Acme/StoreBundle/Controller/HistoryController.php:33
    

    enter image description here

So, strangely, the Watch Expressions window from Eclipse is not working just like the execution engine and/or vice-versa.

Of course, I’d prefer it to be the opposite (It worked in the execution and not in the watch window 🙂 ).

So, any idea?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T22:28:47+00:00Added an answer on June 4, 2026 at 10:28 pm

    You’re currently in the Acme\StoreBundle\Repository\DateTime napespace. To address to the default namespace in this case you need to put leading \ before your classname, like

    $dt = new \DateTime(...);
    

    so

    namespace foo;
    $obj = new class();
    

    will try to find class definition within foo namespace.

    And

    namespace foo;
    $obj = new \class();
    

    will try to find class definition within global namespace.

    As an alternative you could import the class using

    use \DateTime;
    

    or create alias (in case if you already have the class with the same name in current NS):

    use \DateTime as NewDT;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm probably missing something very basic but I cannot figure out why I get
Am I missing something? Why would I get this error? Expected ) before CLLocationDegress.
I know I'm missing something obvious here but I can't seem to get my
Probably missing something completely obvious here, but here goes. I'm starting out with Spring
Maybe I am missing something, but they seem similar. If you use for example...
Am I missing something completely obvious here? My intention is to convert the coordinates
I am probably missing something very simple, but here is the situation: I have
I guess I am missing something very very obvious, but in my RSpec tests
I must be missing something basic here but while developing a custom jQuery widget,
either I'm missing something or the ( patterns & practices Composite Application Guidance for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.