--
You received this message because you are subscribed to the Google Groups "sonata-users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sonata-users/-/QHfcHus3Sk8J.
To post to this group, send email to sonata...@googlegroups.com.
To unsubscribe from this group, send email to sonata-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sonata-users?hl=en.

"No entity manager defined for class Doctrine\Common\Collections\ArrayCollection(500Internal Server Error)"
any idea?
Thanks,
StefanoVisit this group at http://groups.google.com/group/sonata-users?hl=en.For more options, visit https://groups.google.com/groups/opt_out.
I'm stucked in almost the same situation that you, but I've never had that error message. Even so, did you registered the service MagazineAdmin? If so, publish the file to see it.
--
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 sonata-users...@googlegroups.com.
--
I was about to post another message on this thread.
Just some hours ago I got the same error than you, because I'm working in embed forms I guess and the only thing I did was to delete the cache, but not by running app/console cache:clear, but running rm -rfv app/cache/* instead (very risky, by the way), and the error message just dissapeared.
I know it's a dumb question but, did you try clearing the cache?.
<?phpnamespace Application\Sonata\MediaBundle\Entity;use Sonata\MediaBundle\Entity\BaseMedia as BaseMedia;
use Doctrine\ORM\Mapping as ORM;
class Media extends BaseMedia {
/*** @var integer $id*/protected $id;/**
* @ORM\ManyToMany(targetEntity="PL\OrderBundle\Entity\Order", mappedBy="medias")*/protected $orders;/*** @var Collection* @ORM\OneToMany(targetEntity="PL\OrderBundle\Entity\OrderHasMedia", mappedBy="media", cascade={"persist"})**/private $orderDocs;public function __construct() {$this->orders = new \Doctrine\Common\Collections\ArrayCollection();
}/*** Get id** @return integer $id*/public function getId() {return $this->id;}/**
* @param \PL\OrderBundle\Entity\OrderHasMedia $orderDocs* @return Document*/public function addOrdersDocs(\PL\OrderBundle\Entity\OrderHasMedia $orderDocs) {$this->orderDocs[] = $orderDocs;return $this;}/*** @param \PL\OrderBundle\Entity\OrderHasMedia $orderDocs*/public function removeOrderDocs(\PL\OrderBundle\Entity\OrderHasMedia $orderDocs) {$this->orderDocs->removeElement($orderDocs);}/**
* @return \Doctrine\Common\Collections\Collection*/
public function getOrdersDocs() {return $this->orderDocs;}}
<?phpnamespace PL\OrderBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use PL\OrderBundle\DBAL\Types\ChargeStatusType;use PL\OrderBundle\DBAL\Types\TransportMediaType;use PL\OrderBundle\DBAL\Types\IncotermType;use Fresh\Bundle\DoctrineEnumBundle\Validator\Constraints as DoctrineAssert;use Symfony\Component\Validator\Constraints as Assert;
use Gedmo\Mapping\Annotation as Gedmo;use Doctrine\Common\Collections\ArrayCollection;
/*** @ORM\Entity* @ORM\Table(name="tb_order")* @Gedmo\Loggable*/class Order {public static $chargeStatusList = array("0" => "Ninguno","1" => "Proceso de Fabricación","2" => "Pickup en destino","3" => "A la espera de recojo por cliente","4" => "Carga en tránsito","5" => "Carga arribada","6" => "En proceso de aduana","7" => "Entregado a cliente","8" => "En bodega");public static $incotermList = array("0" => "Ninguno","1" => "EWX","2" => "FOB","3" => "CIF","4" => "DDP");public static $transportMediaList = array("0" => "EXW","1" => "Maritimo","2" => "Aereo");/*** @ORM\Id* @ORM\Column(type="string", length=15, unique=true, nullable=false)* @Gedmo\Versioned*/protected $no_order;/*** @ORM\ManyToOne(targetEntity="\PL\CompanyBundle\Entity\Company", inversedBy="orders")* @Gedmo\Versioned*/protected $company;/*** @ORM\Column(type="string", length=15, unique=true)* @Gedmo\Versioned*/protected $business_case;/*** @DoctrineAssert\Enum(entity="ChargeStatusType")* @ORM\Column(name="charge_status", type="ChargeStatusType", nullable=false)* @Gedmo\Versioned*/protected $charge_status;/*** @ORM\Column(type="date")* @Gedmo\Versioned*/protected $eta;/*** @ORM\Column(type="date")* @Gedmo\Versioned*/protected $etd;/*** @DoctrineAssert\Enum(entity="TransportMediaType")* @ORM\Column(name="transport_media", type="TransportMediaType", nullable=false)* @Gedmo\Versioned*/protected $transport_media;/*** @DoctrineAssert\Enum(entity="IncotermType")* @ORM\Column(name="incoterm", type="IncotermType", nullable=false)* @Gedmo\Versioned*/protected $incoterm;/*** @ORM\OneToMany(targetEntity="\PL\OrderBundle\Entity\OrderHasComment", mappedBy="no_order")* @Gedmo\Versioned*/protected $comment;
/*** @ORM\ManyToMany(targetEntity="\Application\Sonata\MediaBundle\Entity\Media", cascade={"all"})
* @ORM\JoinTable(name="order_has_media__media",* joinColumns={@ORM\JoinColumn(name="order_no_order", referencedColumnName="id")},* inverseJoinColumns={@ORM\JoinColumn(name="media__media_id", referencedColumnName="id", onDelete="CASCADE")})*/protected $documents;/*** @var Collection* @ORM\OneToMany(targetEntity="PL\OrderBundle\Entity\OrderHasMedia", mappedBy="order", cascade={"persist"})*/protected $orderDocs;public function __construct() {$this->documents = new \Doctrine\Common\Collections\ArrayCollection();}public function setNoOrder($no_order) {$this->no_order = $no_order;}public function getNoOrder() {return $this->no_order;}public function setCompany(Company $company) {$this->company = $company;}public function getCompany() {return $this->company;}public function setBusinessCase($business_case) {$this->business_case = $business_case;}public function getBusinessCase() {return $this->business_case;}public function setChargeStatus($charge_status) {$this->charge_status = $charge_status;}public function getChargeStatus() {return $this->charge_status;}public function setETA($eta) {$this->eta = $eta;}public function getETA() {return $this->eta;}public function setETD($etd) {$this->etd = $etd;}public function getETD() {return $this->etd;}public function setTransportMedia($transport_media) {$this->transport_media = $transport_media;}public function getTransportMedia() {return $this->transport_media;}public function setIncoterm($incoterm) {$this->incoterm = $incoterm;}public function getIncoterm() {return $this->incoterm;}public function setComment(\PL\OrderBundle\Entity\OrderHasComment $comment) {$this->comment = $comment;}public function getComment() {return $this->comment;}public function setDocuments(\Application\Sonata\MediaBundle\Entity\Media $documents) {$this->documents[] = $documents;}public function getDocuments() {return $this->documents;}/*** @param \PL\OrderBundle\Entity\OrderHasMedia $orderDocs* @return Document*/public function addOrdersDocs(\PL\OrderBundle\Entity\OrderHasMedia $orderDocs) {$this->orderDocs[] = $orderDocs;return $this;}/*** @param \PL\OrderBundle\Entity\OrderHasMedia $orderDocs*/public function removeOrderDocs(\PL\OrderBundle\Entity\OrderHasMedia $orderDocs) {$this->orderDocs->removeElement($orderDocs);}/**
* @return \Doctrine\Common\Collections\Collection*/
public function getOrdersDocs() {return $this->orderDocs;}public function setOrderDocs($orderDocs) {$this->orderDocs = new ArrayCollection();foreach ($orderDocs as $orderDoc) {$orderDoc->setOrder($this);$this->addOrdersDocs($orderDoc);}}public function getChargeStatusValue() {return self::$chargeStatusList[$this->charge_status];}public function getIncotermValue() {return self::$incotermList[$this->incoterm];}public function getTransportMediaValue() {return self::$transportMediaList[$this->transport_media];}}
<?phpnamespace PL\OrderBundle\Entity;
use Doctrine\ORM\Mapping as ORM;use Doctrine\Common\Collections\ArrayCollection;
/*** @ORM\Entity* @ORM\Table(name="order_has_media__media")*/class OrderHasMedia {/*** @var Order* @ORM\ManyToOne(targetEntity="PL\OrderBundle\Entity\Order", inversedBy="orderDocs", cascade={"persist"})*/private $order;/*** @var Media* @ORM\ManyToOne(targetEntity="Application\Sonata\MediaBundle\Entity\Media", inversedBy="orderDocs", cascade={"persist"})*/private $media;/*** @param \PL\OrderBundle\Entity\Order $order* @return PageHasMedia*/public function setOrder(\PL\OrderBundle\Entity\Order $order = null) {$this->order = $order;
return $this;}/*** Get id_page*
* @return \PL\OrderBundle\Entity\Order*/public function getOrder() {return $this->order;
}/*** Set id_media*
* @param Application\Sonata\MediaBundle\Entity\Media $media* @return PageHasMedia*/public function setMedia(\Application\Sonata\MediaBundle\Entity\Media $media = null) {$this->media = $media;return $this;}/*** @return \Application\Sonata\MediaBundle\Entity\Media*/public function getMedia() {return $this->media;}}
protected function configureFormFields(FormMapper $form) {$form->add('no_order', null, array('label' => 'No. Order'))->add('company', 'entity', array('class' => 'PL\CompanyBundle\Entity\Company', 'label' => 'Cliente'))->add('business_case', null, array('label' => 'BC'))->add('charge_status', 'choice', array('choices' => Order::$chargeStatusList, "empty_value" => "Seleccione una opción", "required" => true, 'label' => 'Estado de la carga'))->add('eta', 'date', array('label' => 'ETA', 'widget' => 'single_text', 'required' => false, 'attr' => array('class' => 'datepicker')))->add('etd', 'date', array('label' => 'ETD', 'widget' => 'single_text', 'required' => false, 'attr' => array('class' => 'datepicker')))->add('transport_media', 'choice', array('choices' => Order::$transportMediaList, "empty_value" => "Seleccione una opción", "required" => true, 'label' => 'Via de Transporte'))->add('incoterm', 'choice', array('choices' => Order::$incotermList, "empty_value" => "Seleccione una opción", "required" => true, 'label' => 'Incoterm'))->add('orderDocs', 'sonata_type_collection', array('cascade_validation' => true,
), array('edit' => 'inline','inline' => 'table','sortable' => 'position',
'link_parameters' => array('context' => 'default')
));}public function prePersist($doc) {$doc->setOrderDocs($doc->getOrdersDocs());}public function preUpdate($doc) {$doc->setOrderDocs($doc->getOrdersDocs());}
<?php/*** Description of OrderAdmin*/namespace PL\OrderBundle\Admin;
use Sonata\AdminBundle\Admin\Admin;use Sonata\AdminBundle\Form\FormMapper;use Sonata\AdminBundle\Datagrid\DatagridMapper;use Sonata\AdminBundle\Datagrid\ListMapper;
use Sonata\AdminBundle\Show\ShowMapper;class OrderHasMediaAdmin extends Admin {protected function configureFormFields(FormMapper $formMapper) {function configureFormFields(FormMapper $formMapper) {$formMapper->add('media', 'sonata_type_model_list', array('required' => false,), array('link_parameters' => array('provider' => 'sonata.media.provider.file', 'context' => 'default')));}}}
->add('orderDocs', 'sonata_type_collection',
Cassiano Valle Tartari
MSc. Computer Engineer
Tel: +55.48.84474818
Email: fal...@cassianotartari.eng.br
Site: http://www.cassianotartari.eng.br
--
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 sonata-users...@googlegroups.com.
To post to this group, send email to sonata...@googlegroups.com.
Visit this group at http://groups.google.com/group/sonata-users.
Cassiano Valle Tartari
MSc. Computer Engineer
Tel: +55.48.84474818
Email: fal...@cassianotartari.eng.br
Site: http://www.cassianotartari.eng.br
company.order.admin.orderhasmedia:
class: PL\OrderBundle\Admin\OrderHasMediaAdmin
arguments: [null, PL\OrderBundle\Entity\OrderHasMedia, 'SonataAdminBundle:CRUD']
tags:
- { show_in_dashboard: false, name: sonata.admin, manager_type: orm, group: group_order, label: menu_order_has_media, label_translator_strategy: sonata.admin.label.strategy.underscore, label_catalogue: OrderBundle }
I'm happy to know that it works!
Probably you don't have the translation for this "form.label_media" try to add in the translation files.
To hide the list button just add the follow in your admin class:
use Sonata\AdminBundle\Route\RouteCollection;
protected function configureRoutes(RouteCollection $collection) {
$collection->remove('list');
}
On Fri, Feb 28, 2014 at 11:29 AM, Cassiano Tartari <cassian...@gmail.com> wrote:
I'm happy to know that it works!Happiness is not for eternity :-( since I get another issue. I attached to images to the post. In 1.png you can see the file because I hit "Agregar nuevo" button and upload a file. Now I want to delete that file so I check the option and hit "Borrar" button and file name disappear but the row still there when it shouldn't be since I delete "apparently" the file, is that behavior right? Or I miss something else?
On Fri, Feb 28, 2014 at 11:29 AM, Cassiano Tartari <cassian...@gmail.com> wrote:
I'm happy to know that it works!Happiness is not for eternity :-( since I get another issue. I attached to images to the post. In 1.png you can see the file because I hit "Agregar nuevo" button and upload a file. Now I want to delete that file so I check the option and hit "Borrar" button and file name disappear but the row still there when it shouldn't be since I delete "apparently" the file, is that behavior right? Or I miss something else?
Probably you don't have the translation for this "form.label_media" try to add in the translation files.
I copied the file SonataMediaBundle.es.xliff from \vendor\sonata-project\media-bundle\Sonata\MediaBundle\Resources\translations to \Application\Sonata\MediaBundle\Resources\translations delete all it content and add this line:<?xml version="1.0"?><xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2"><file source-language="en" target-language="es" datatype="plaintext" original="SonataMediaBundle.en.xliff"><body><trans-unit id="form.label_media"><source>form.label_media</source><target>Documento</target></trans-unit></body></file></xliff>Doesn't work. Once again I miss something?
public function removeUpload() with @ORM\PostRemove() and @ORM\HasLifecycleCallbacks