Hi everyone,
I use Sonata to make an app and I am facing some problem with MediaBundle.
I Have two entities : Product & ProductImage
Inside Product I have this :
/**
* @ORM\ManyToMany(targetEntity="ProductImage", cascade={"persist"},
fetch="LAZY", indexBy="ASC")
*/
protected $medias;
Inside ProductImage :
/**
* @ORM\ManyToOne(targetEntity="Product", cascade={"persist"}, fetch="LAZY")
*/
protected $Product;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Media\Media",
cascade={"persist"}, fetch="LAZY")
*/
protected $image;
public function __toString()
{
return $this->getImage();
}
In my ProductAdmin.php file :
public function configureShowFields(ShowMapper $showMapper)
{
$showMapper
->add('name')
->end()
->with('Medias', array('class' => 'col-md-12'))
->add('medias', 'sonata_type_collection', array(), array(
'inline' => 'table',
'sortable' => 'position'
))
->end();
}
When I go to the show page ( .../product/6/show), I have all my information
correctly displayed but medias is just a list of image name.
How can I display each image instead of name ?
I use basic CRUD capacity and templates from sonata. I have no custom
controller nor views.
Thanks
--
You received this message because you are subscribed to the Google Groups
"sonata-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sonata-users.
For more options, visit https://groups.google.com/d/optout.