Question

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 !

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top