Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Question regarding DB and ActiveRecord
  • Does the ActiveRecord and DB class allow doing querys like:
    SELECT * FROM `table` WHERE `something` = 'some_value' 
          AND (`secondthing` LIKE '%stuff%' OR `thirdthing` LIKE '%stuff%')
    

    As i just had this issue with CodeIgniter where apparently this is a limitation and you can't do this except if you write the sql query yourself and then do db->query().
    The CodeIgniter class can only generate the query like this:
    SELECT * FROM `table` WHERE `something` = 'some_value' 
          AND `secondthing` LIKE '%stuff%' 
          OR  `thirdthing`  LIKE '%stuff%'
    
  • @daniels I looked through the code, but i couldn't find any ompatibility with these formats. The Database_Query_Builder_Where class does allow it, but the linking with the DB class is not through magic methods. If you however need the functionality, I'd suggest to look into the Kohana ORM for Fuel:
    https://github.com/TJS-Technology/fuel-kohana-orm
    It's an nice port from Ben Corlett. Hope it helps :)
  • Thanks.
    I haven't started using FuelPHP yet as I'll wait for 1.0 first so maybe they can take this into account and implement it before 1.0
    Really nice work by Ben Corlett with his port but i don't know why but i fell more comfortable by using the libs that are released with Fuel and are officially supported by the devs, especially for such trivial tasks as DB. Or the port of the Kohana lib is meant as a replacement for Fuel's ActiveRecord?
    Will Fuel's ActiveRecord still be made?
  • The kohana port is setup in a way that the original class isn't affected at all. It runs through the DB class which is just a direct copy of Kohana's DB class - literally copy and paste. Comments and all. So it basically works perfectly in Fuel. When Kohana is updated, the package is updated. New features, bug fixes etc...
  • Yeah it's a replacement for activerecord. I got the shits with the lImitations of the activerecord class (as it is just now)

Howdy, Stranger!

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

In this Discussion