Ruby style relational tables in PHP

I know that ruby ​​(on rails) uses a lot of β€œmagic”, but I use PHP, is there any way to implement rails:

class Player < ActiveRecord::Base has_many :cards end 

in PHP it will make so many peoples live a lot easier. Are there possibly / ORM frameworks that provide similar functionality, etc.?

+4
source share
3 answers

The term you are looking for is "Object Relational Mapper" (ORM). The one you are quoting is a component of a Rails environment called ActiveRecord.

PHP ActiveRecord is one of the projects that is trying to provide this, although the latest version was in July 2010. I didn’t actually use it; I just switched to Rails. :)

+2
source

in CakePHP there are relationships like hasMany, owned by Too, hasOne and hasAndBelongsToMany

+2
source

PHP does not have an ORM in itself, but there are several fairly used ORM projects for it; I am familiar with Propel , and it is pretty good (used, for example, in the Symfony framework, which is a bit like Ruby).

+1
source

Source: https://habr.com/ru/post/1346067/


All Articles