KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I try to embed a form type into another form type : $builder->add('geolocation', new GeolocationType()); However when I try and bind the request to the form if($request->getMethod() == 'POST') { $form->bindRequest($request); } I get the error Catchable Fatal Error: Argument 1 passed to Company\StoreBundle\Document\Place::setGeolocation() must be an instance of Company\StoreBundle\Document\Geolocation, array given, called in /var/www/Company/vendor/symfony/src/Symfony/Component/Form/Util/PropertyPath.php on line 392 and defined in /var/www/Company/src/Company/StoreBundle/Document/Place.php line 43 The data_class is set either for the PlaceType and the GeolocationType Here is my code : Place.php namespace Company\StoreBundle\Document; use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB; /** * @MongoDB\Document(collection="places") */ class Place { /** * @MongoDB\Id */ private $id; /** * @MongoDB\String */ private $title; /** * @MongoDB\EmbedOne(targetDocument="Geolocation") */ private $geolocation; /** * Get id * * @return id $id */ public function getId() { return $this->id; } /** * Set geolocation * * @param Company\StoreBundle\Document\Geolocation $geolocation */ public function setGeolocation(\Company\StoreBundle\Document\Geolocation $geolocation) { $this->geolocation = $geolocation; } /** * Get geolocation * * @return Company\StoreBundle\Document\Geolocation $geolocation */ public function getGeolocation() { return $this->geolocation; } /** * Set title * * @param string $title */ public function setTitle($title) { $this->title
Tags (comma-separated)
Save Edits
Cancel