What ORM solutions are available for Kohana 3.1? - php

Kohana 3.0 used to have Sprig, Jelly, etc. alongside with its default ORM system. As far as I understand, Kohana 3.1 is not compatible with Sprig and Jelly and its default ORM is still in development. What to use for ORM in Kohana 3.1 then?

Take a look at Leap ORM for Kohana. You can download it off github at https://github.com/spadefoot/kohana-orm-leap
This ORM is designed to work with Kohana 3.0.X, Kohana 3.1.X, and Kohana 3.2. It works with all major databases (including MySQL, MariaDB, PostgresSQL, MS SQL, DB2, Oracle, Firebird, and Sqlite) unlike the other Kohana ORMs that I have seen. Expanding the ORM is extremely easy whereas Kohana's default ORM cannot be adapted to work with such databases without a lot of work.
It is pretty well documented. Unlike other ORMs for Kohana that I have seen, it can handle composite primary keys and can use more than integers as primary keys (e.g. strings). It also give you the flexibility to switch the database driver from the standard PHP extensions to PDO using a simple config file.

You can find 3.1 modules at Github:
Jelly for 3.1 (unofficial fork, Banks and Jonathan Geiger have no time for development)
Sprig branch for 3.1

Have you checked out PHP ActiveRecord? It is an ActiveRecord style ORM with validations, realtionships, eager loading, etc.

I strongly suggest you to use:
http://www.doctrine-project.org/projects/orm
I have used both the default ORM in Kohana 3.0 (should be similar to the one in 3.1) and the doctrine ORM in big projects.
Doctrine is great. Everything you wan't is there. Even for very special and tricky cases. If you use the default Kohana 3 ORM you will end up extending it because it is to simple.
The configuration part in Doctrine can be a little scary because there are a lot of options. In the long run it is really worth it though :)

Related

Is the Doctrine Migrations project compatible with Doctrine MongoDB?

Is the Doctrine Migrations project compatible with Doctrine MongoDB?
It isn't clear to me from searching and looking at the Doctrine Migrations project whether it is compatible with ODM solutions (e.g. MongoDB) as well as ORM solutions.
If it is, can anyone suggest examples or articles on how to use the two together?
If it isn't, are there reasonable alternatives?
Question Background:
I understand, marginally, the different approaches to migrating a document's data from one version of the document to another and the pros and cons of each.
I am leaning towards possibly implementing a hybrid approach of gradual schema changes and migration scripts as suggested here. Leveraging the functionality within Doctrine's MongoDB library written about by Jonathan Wage in his post: Doctrine MongoDB ODM Schema Migrations.
Even with that, I need to find some way of creating a migration script or performing the data migration, and Doctrine Migrations seemed like a good first choice.
As an aside, another user warns against using the approach Jonathan Wage presents above for migrating data and instead running commands (JavaScript?) directly against the database.
Despite doctrine-migrations is not compabible with MongoDB ODM (it only supports DBAL) you can bet for the alternative mongo-based migration components made by 3rd party teams.
It was firstly developed here https://github.com/antimattr/mongodb-migrations
but after it has been abandoned the project continues here https://github.com/doesntmattr/mongodb-migrations
Ufortunately, it isn't compatible with ODM. It supports ORM only.

PHP annotations : Addendum or Doctrine Annotation?

Addendum
Doctrine 2 Annotations
Can you give me any reason one is better than the other ?
Here my list for now :
Addendum is a project dedicated for that
Addendum seems to have more functionnalities
Addendum API seems easier to use
Doctrine has more support and more people involved
Doctrine seems to be a project more alive
Doctrine is fully compatible PHP 5.3, whereas Addendum seems to be trying to become compatible (see home page)
Doctrine Annotations can be cached easily
The decision is not easy...
I suppose I'd rather use the Doctrine's component :
I've never heard of Addendum -- while I've heard a lot about Doctrine (and have used it several times)
Which means more community and support for Doctrine
Doctrine is used by some big Frameworks (symfony ; and can easily be integrated with Zend Framework)
Which means chances are higher that you'll already use Doctrine ; and find developers who are familiar with its syntax
Maybe less important for you, But some guy from Doctrine's team has done some work on getting Annotations integrated into PHP
There is a RFC : Request for Comments: Class Metadata
For now, it doesn't seem this is going to be integrated into PHP, but it means there is works done by the Doctrine's team, that shows their solution has some thinking
For what it's worth...
I've been using Addendum for a year now, and I've found it ridiculously easy to use. Its extension to the PHP Reflection API is seamless, and it supports far more use cases than Doctrine Annotations component.
It lacks namespaces support, but I could patch AnnotationMatcher class so it accepted namespaced classes (without getting false matches from docblock tags) and it has worked like a charm.
Doctrine's annotations takes into account PHP 5.3 use statements. That's the only thing that Addendum does not do and IMO it wouldn't be so trivial to implement.

how to compare between Doctrine & Propel in symfony

I am in the early stages of rearchitecting my company's application. The app is currently running on symfony 1.2, and I used the default ORM at the time, Propel.
Symfony has since updated to 1.4 and switched default ORM to Doctrine.
From my understanding, each ORM excels at particular types of database structures. Is this true or is one far and away better than the other?
Are there any good methods to test which ORM would be best in my situation in a test environment using my schema (i.e.- set up dual, identical sites and run tests)?
Here's a slightly newer comparison than the 2008 one: Doctrine vs Propel: 2009 update. There's also a (slightly Propel focussed) benchmarking exercise here.
In reality, the community around the frameworks is as important as the technical differences. I'm using Doctrine as I've been able to find much more relevant support information and examples. The traffic to the Symfony website suggests that that Doctrine is becoming the most popular choice, so I expect the Symfony/Doctrine community to continue to grow.
Symfony 1.4 default ORM is currently Doctrine 1.2.
I don't is there's any performance difference between Propel and Doctrine 1.2 but you can also use Doctrine 2.0 with this version of Symfony : done here
Doctrine 2 is a complete rewrite of Doctrine, seems to be faster and supports ODM like MongoDB.

Starting with Doctrine. Which version is good to?

I'm using Zend Framework and I feel that I need a good ORM to work with. I don't know much of Zend Framework, I just know how to do the basics. I expect to work together with both Doctrine and Zend Framework
But to sget started, I'm going to try a simple Doctrine project (no ZF) to get used to the application. Then I'll try to integrate it in ZF
Which version of Doctrine do I start learning? Does Doctrine have a good integration with ZF?
Besides,
Is there any recent site for Doctrine learning? I just can't find the sandbox version to follow the Doctrine documentation. If anyone knows of any tutorial on how to get started with doctrine only first, please let me know
I've done projects with zend framework and doctrine. They play pretty nice together.
I followed this tutorial and it worked well.
But honestly I don't use doctrine on anything but the largest sites. I've switched over to RedBean. Zero configuration autodiscovery, and the ability to freeze data models when you are done for maximum performance.
You should really try it out, it is so simple its stupid. It is really one of the best ORM's ive ever used. EVER. Try it.
I am personally using Doctrine 1.2
and i followed the Zendcasts.com "more than 5 casts about doctrine" & same Byron's tuts
both of them is good
Update :
1- http://www.zendcasts.com/deep-integration-between-zend-and-doctrine-1-2/2010/01/ has the sample code
2- http://www.doctrine-project.org/projects/orm/1.2/download/1.2.3 has the doctrine framework if you need to download it alone
I've found Doctrine2 reasonable stable, although it's still in beta. It seems most of the other PHP 'ORM' libraries (Doctrine 1.2 included) are Active Record, while Doctrine2 is a Data Mapper. In my opinion, you can put together a relatively simple Active Record using Zend's native Db_Table, so that makes Doctrine 1.2 less appealing (at least to me).
I've used this answer about integrating Doctrine2 and Zend Framework.
I agree with Byron, and have only used Doctrine2 on select projects.
[As an aside, I've noticed RedBean in the past, and have wanted to try it - from what I've seen it's certainly worth taking a look.]
Doctrine 2 is in beta and requires PHP5.3 as it fully utilizes Namespaces. If you cannot use PHP5.3 in your project, you cannot use Doctrine 2.
Apart from that, there has been a number of architectural changes in Doctrine 2 that make it much more attractive than Doctrine < 2, mainly
using DataMapper instead of ActiveRecord
promotes DI over static calls
faster and less memory-intensive
revolves around Entities and DDD
uses "Annotations"
See
http://architects.dzone.com/articles/doctrine-1-doctrine-2
http://www.slideshare.net/jwage/doctrine-2-not-the-same-old-php-orm

Doctrine 2.0 ready for use?

I'm working on a small project (some mark tracking software for a school subject department - PHP frontend with a sqlite DB) and have decided to use ORM.
I've taken a look at RedBeanPHP but it seemed a bit too limited for my liking. As such, I've decided to give Doctrine a go.
My only prior experience with ORM is LINQ to SQL in .NET. Anyway, I was wondering if I should get started with Doctrine 2.0 (which is in beta at the moment) or if I should take sometime to learn 1.2.
I'm looking for feedback from those who are comfortable with both, and more importantly, I'd like to know how complete the Doctrine 2.0 documentation is. Is there enough information on the website for somebody new to Doctrine (and quite new to ORM) to get up and running with 2.0 or is the documentation for the new version still quite lacking?
Doctrine 2 is a DataMapper ORM whereas 1.2 is Active Record. I would go with 2.0; the documentation is great
The Doctrine2 documentation is quite good already. I'd start with the reference.
I've been developing with Doctrine2 for a few months now, and have had no issues. I'll be going into production with it soon, and am pretty confident.
2.0's DataMapper pattern is really superior to the 1.2/ActiveRecord model. Very flexible, and possible more performant. If you're starting development today, I think it's very likely the best way to go.

Categories