php - Modify doctrine 2 proxy class -


i have 2 entities entitya , entityb, linked 1 1 relationship

entityb

company\bundles\entitybundle\dataobjects\entity\entityb:   type: entity   table: notice   fields:     identityb:       id: true       type: string       length: 50       fixed: false       nullable: false       column: id_entityb       generator:         strategy: identity      name:       type: string       length: null       fixed: false       nullable: true       column: name    onetoone:     entitya:       targetentity: entitya       mappedby: entityb       lifecyclecallbacks: {  } 

entitya

company\bundles\entitybundle\dataobjects\entity\entitya:   type: entity   table: entitya   fields:     identitya:       id: true       type: integer       unsigned: false       nullable: false       column: id_entitya       generator:         strategy: identity     identityb:       type: string       length: 50       fixed: false       nullable: false       column: id_entityb   onetoone:     entityb:       targetentity: entityb       joincolumn:         name: id_entityb         referencedcolumnname: id_entityb   lifecyclecallbacks: {  } 

when retrieve instance of entitya, , linked entityb, modify , try save modifications this

$enta = //get instance of entitya using em's query builder $entb = $enta->getentityb(); $entb->setname('test'); $em->persist($entb); 

i following error

 exception 'doctrine\orm\mapping\mappingexception' message 'class proxies\myentitynamespaceentitybproxy not valid entity or mapped super class.' in .../vendor/doctrine/lib/doctrine/orm/mapping/mappingexception.php:142 

it seems error because $entb instance of proxy class.

question: how can modify $entb?

i'm using doctrine 2.1

update: added simplified yml , corrected call $em->persist


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -