Skip to content

Conversation

@dereuromark
Copy link
Owner

@dereuromark dereuromark commented Feb 28, 2024

    $this->addBehavior('Geo.Geocoder', ['address' => ['street', 'postal_code', 'city', function (Event $entity) {
        if ($entity->country && $entity->country->id && $entity->country_id === $entity->country->id) {
            return $entity->country->name;
        }
        if ($entity->get('country_name')) {
            return $entity->get('country_name');
        }

        if ($entity->country_id) {
            $country = $this->Countries->get($entity->country_id);
            return $country->name;
        }

        return null;
    }]]);

@dereuromark dereuromark merged commit 9913525 into master Feb 28, 2024
@dereuromark dereuromark deleted the address-element-closure branch February 28, 2024 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants