Symfony and Sonata get Class with "pcode"

Wednesday, November 4, 2015

I'm having problem to get the Class which is called by the 'Add New' and the Modal Window.



The situation is that, I have a 'Add New' button on my entry with sonata_type_model:



->add('rfid', 'sonata_type_model', array(
'class' => 'Admin\IdManageBundle\Entity\RFID',
'property' => 'barcode'
))


when I click on 'Add New' it shows me a Modal Window, with which I can create new RFID.



but my RFID class has a barcode object that must be filled with the data of the class had the 'Add New' button!



I can handle the parent class with



->add('barcode', 'text', array(
'data' => $this->getRequest()->get('pcode')
))


but I want to be able to get the Entity Manager of the responded 'pcode'
In my case $this->getRequest()->get('pcode') returns:




admin_product_accessory_audio_audio.admin.audio




and it's not readable by $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository($this->getRequest()->get('pcode'))



It has made me crazy!! :D



thanks in advance

0 comments:

Post a Comment