Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Question about DB class and ORM package
  • Hello there,

    If I can not use that much memory then should I use DB class or DB utils class?

    It seems ORM package uses lots of memory.

    thank you.

  • HarroHarro
    Accepted Answer
    DB class is for database interaction. DBUtil class is for schema manipulation.

    The ORM is primarily designed for interactive functionality, not for batch operations. It caches every ORM object to ensure consistency between multiple queries on the same object:

    $userA = Model_User::find(1);
    $userB = Model_User::find(1);

    You will see that $userA === $userB, they are the same object, not two diffferent objects with the same content. So after you change a $userA property, $userB is also changed.

    If you want to use the ORM in bulk operations, you need to disable the caching mechanism.  You need the 1.9/develop version of the ORM code for that. With it, you can set the "caching" variable in the orm config file to false, to disable all object caching.
  • Thank you very much for your explanation and suggestion.

    I may use DB class for the batch operations.

    Thank you very much for that :)


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion