문제

How can I implement models inheritance with phalcon's ORM ? I mean in doctrine I can tell the inheritance strategy and it maps my models to the database. Is that possible with phalcon's ORM ? Thanks !

도움이 되었습니까?

해결책

I believe that the answer is no, there's nothing like this yet. In Phalcon's Model Documentation and anywhere else I've always seen the ORM working passively with the database schema (never creating or changing any schema at all).

Not sure if it helps but you can extend a Model and make it use the same table of their parent:

use Phalcon\Mvc\Model as PhModel;

class Person extends PhModel {...} //This will use a pre-existent 'person' table

class Employee extends Person 
{
    public function getSource()
    {
        return 'person'; //This will also use the 'person' table
    }
}

If I misunderstood your question, please provide more details.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top