09-17-2018, 12:39 AM
The thing with an ORM is - it helps you structure your data (and i'm not talking about doctrine, propel or any other siwss army knifed constructions)
it doesn't really depend on which database you use.
If you have relations from one data to another, you should have an automated way to structure those data, because it really helps if you don't have to care about that.
In my opinion, thats what a framework should stand for - because it has the duty to support excactly those tasks.
E.g. it was a nightmare for us to develop applications in CI before we developed our "own" simple ORM (loosely based on Laravels approach).
You can see an example how such a model looks like below:
And thats it - defining Relations how certain data are standing to each other isn't really an opinion based concept rather than based on facts (in our case a book has chapters and an author). So i'm really curious, why you guys are so eager to avoid exactly this topic at all costs.
Because exactly this concept would help so much others (i don't know how many SO posts i've seen where people actually got lost because of the frameworks inability to deliver this task...)
it doesn't really depend on which database you use.
If you have relations from one data to another, you should have an automated way to structure those data, because it really helps if you don't have to care about that.
In my opinion, thats what a framework should stand for - because it has the duty to support excactly those tasks.
E.g. it was a nightmare for us to develop applications in CI before we developed our "own" simple ORM (loosely based on Laravels approach).
You can see an example how such a model looks like below:
PHP Code:
class Book_model extends CrudDb_Model
{
public $strDbTable = 'books';
public $strDbTableObject = 'Book_Object';
public function __construct() {
parent::__construct();
$this->addConnections([
'author' => Relations_Factory::One(
'author',
'resources/Author_model',
[
'author_id' => 'id'
]
),
'chapter' => Relations_Factory::Many(
'chapter',
'resources/Chapter_model',
[
'id' => 'book_id'
]
),
]);
}
}
And thats it - defining Relations how certain data are standing to each other isn't really an opinion based concept rather than based on facts (in our case a book has chapters and an author). So i'm really curious, why you guys are so eager to avoid exactly this topic at all costs.
Because exactly this concept would help so much others (i don't know how many SO posts i've seen where people actually got lost because of the frameworks inability to deliver this task...)