Skip to content
This repository was archived by the owner on Nov 9, 2024. It is now read-only.
This repository was archived by the owner on Nov 9, 2024. It is now read-only.

I dont understand how the ComplexGooglePlaceAutocompleteType works #3

@beejaz

Description

@beejaz

Hi,

Could you help me with the ComplexType-object, I cant get it to work. I must be doing something totally wrong.

In my OrderController, ive added:
use Cethyworks\GooglePlaceAutocompleteBundle\Form\ComplexGooglePlaceAutocompleteType;
->add('maps', ComplexGooglePlaceAutocompleteType::class, ["mapped" => false]);

I get match with Autocomplete function from Google and I press Send, but the form only sends this to the controller:
array(11) { ["maps"]=> array(3) { ["name"]=> string(0) "" ["address_components"]=> string(205) "[{"long_name":null,"types":["street_number"]},{"long_name":null,"types":["route"]},{"long_name":null,"types":["locality"]},{"long_name":null,"types":["postal_code"]},{"long_name":null,"types":["country"]}]" ["autocomplete"]=> string(31) "Examplestreet 100, Stockholm, Sverige" } ["_token"]=> string(43) "r-LNm0oijTqOqh2j6VDCZJ5fQ57GGmteEtuJaN3HDF4" }

My entity for Order has:
/**
* @var Place
*
* @Orm\Embedded(class="Cethyworks\GooglePlaceAutocompleteBundle\Model\Place")
*
*/
private $locationAddress;

And the error i get is:
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'location_address_name' cannot be null

Can you point me in the correct direction? :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions