A
A
Alexey Krichko2014-05-15 17:35:38
symfony
Alexey Krichko, 2014-05-15 17:35:38

Error when creating a new instance of an inherited entity in Symfony2?

There is a Page entity, everything is ok with it: instances are created.
Created the Good entity, class Good extends Page
added a couple of additional fields to it and inherited the constructor from the parent

public function __construct()
{
    parent::__construct();
}

I copied the form from Page, replacing only the name and
$resolver->setDefaults(array(
            'data_class' => 'alkr\ShopBundle\Entity\Good'
        ));

When creating a new instance, I catch the error:
An exception occurred while executing 'SELECT p0_.path AS path_0, p0_.id AS id_1, p0_.prior AS prior_2, p0_.url AS url_3, p0_.enabled AS enabled_4, p0_.feedback AS feedback_5, p0_.map AS map_6, p0_.lvl AS lvl_7, p0_.lastmod AS lastmod_8, p0_.view AS view_9, p0_.annotation AS annotation_10, p0_.content AS content_11, p0_.title AS title_12, p0_.metaTitle AS metaTitle_13, p0_.menuTitle AS menuTitle_14, p0_.keywords AS keywords_15, p0_.description AS description_16, g1_.price AS price_17, g1_.amount AS amount_18, p0_.parent_id AS parent_id_19, p0_.preview AS preview_20 FROM Good g1_ ORDER BY g1_.path ASC':

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'p0_.path' in 'field list'

Those. although all inherited fields are present in a particular Good table, in the query, when creating the form, they are drawn to the fields of the parent entity. What am I doing wrong?
Or, perhaps, everything is wrong here, but it was necessary to use Mapped Superclasses?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Krichko, 2014-05-15
@sand_alkr

I did as stated here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question