2

I working mostly with DataMapper in Ruby and Merb, so im looking for PHP ORM that is similar to DataMapper. Any good ones?

Martin Geisler
  • 69,865
  • 23
  • 162
  • 224
Dan Sosedoff
  • 2,683
  • 5
  • 25
  • 34

6 Answers6

2

I believe Doctrine is implemented in a similar way.

Kieran Hall
  • 2,617
  • 2
  • 23
  • 27
1

The phpDataMapper project was created specifically to be like Ruby's DataMapper. If you're interested in the project, please help me out! I'm looking for more people who know Ruby DataMapper to help expand the project faster.

GitHub Project Page: https://github.com/vlucas/phpDataMapper/tree

Vance Lucas
  • 2,688
  • 1
  • 23
  • 21
0

Propel is an ORM for php5, you might also look at XPDO

0

There is db.php orm (http://dbphp.net) it does everything you listed but does not support memcache instead it uses apc user cache functions and also delivers ability to override cache engine class just by extending \db\cache basic class like that (originally this is db.php's long cache class using apcu):

    class long extends cache
    {
        function store ($name, $value)
        {
            if (is_bool($value))
            {
                \apc_delete ($name);
            }
            else
            {
                \apc_store ($name, $value);
            }
        }
        function fetch ($name)
        {
            return \apc_fetch ($name);
        }
        function clear ()
        {
            \apc_clear_cache ('user');
        }
    }

So if you implement class like mymemcache extends \db\cache and override this three methods afterwards you can attach your cache engine to your orm like that:

$database->context->caches[\db\cache::long] = new mymemcache();

And things will go smoothly.

I developed my custom cache engine for specific environment just by extending \db\cache like that.

BIOHAZARD
  • 1,689
  • 17
  • 22
0

I would suggest that you take a look at this question for suggestions.

If you are looking for an ORM that implements the Data Mapper paradigm rather than Active Record specifically then I would strongly suggest that you take a look at GacelaPHP.

Gacela Features:

  • Data mapper
  • Foreign key mapping
  • Association mapping
  • Dependent mapping
  • Concrete table inheritance
  • Query object
  • Metadata mapping
  • Lazy & eager loading
  • Full Memcache support

Other ORM solutions are too bloated or have burdensome limitations when developing anything remotely complicated. Kacela resolves the limitations of the active record approach by implementing the Data Mapper Pattern while keeping bloat to a minimum by using PDO for all interactions with the DB and memcache.

Community
  • 1
  • 1
Noah Goodrich
  • 23,504
  • 12
  • 61
  • 95
-1

I've never worked on DataMapper before but you could check out the Cakephp framework it has very similar ORM to ROR.

drikoda
  • 1,613
  • 1
  • 16
  • 20