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