I want to do this:
// Model class namespace Bookshop\Inventory\Model; use Core\Inventory\Model\Product as BaseProduct; class Book extends BaseProduct { // ... } // Query class namespace Bookshop\Inventory\Model; use Core\Inventory\Model\ProductQuery as BaseProductQuery; class BookQuery extends BaseProductQuery { // ... }
It looks good, right? But:
$book = BookQuery::create()->find($id); var_dump(get_class($book));
AFAIK, this is because Propel relationships are defined at build time and not at run time ... The only way I found to achieve this is to use the extension behavior found in GlorpenPropelBundle and the definition of extended classes in my configuration:
glorpen_propel: extended_models: Core\Inventory\Model\Product: Bookshop\Inventory\Model\Book
Ok, this works, but of course, the best way? Am I missing something, or is this really the only way to extend models in Propel + Symfony? I really want to use Propel over Doctrine, but things like that leave me in mind that Propel is just not suitable for projects with a specific size ...
(Propel 1.6 + Symfony 2.3 btw)
source share