diff --git a/addons/default/visiosoft/location-module/src/City/Command/GetCity.php b/addons/default/visiosoft/location-module/src/City/Command/GetCity.php new file mode 100644 index 000000000..efe367a10 --- /dev/null +++ b/addons/default/visiosoft/location-module/src/City/Command/GetCity.php @@ -0,0 +1,34 @@ +id = $id; + } + + + /** + * @param CityModel $groups + * @return |null + */ + public function handle(CityModel $groups) + { + if ($this->id) { + return $groups->find($this->id); + } + return null; + } +} diff --git a/addons/default/visiosoft/location-module/src/Country/Command/GetCountry.php b/addons/default/visiosoft/location-module/src/Country/Command/GetCountry.php new file mode 100644 index 000000000..0e41d4925 --- /dev/null +++ b/addons/default/visiosoft/location-module/src/Country/Command/GetCountry.php @@ -0,0 +1,33 @@ +id = $id; + } + + /** + * @param CountryModel $groups + * @return |null + */ + public function handle(CountryModel $groups) + { + if ($this->id) { + return $groups->find($this->id); + } + return null; + } +} diff --git a/addons/default/visiosoft/location-module/src/LocationModulePlugin.php b/addons/default/visiosoft/location-module/src/LocationModulePlugin.php index 23db88713..9d9d16ff9 100644 --- a/addons/default/visiosoft/location-module/src/LocationModulePlugin.php +++ b/addons/default/visiosoft/location-module/src/LocationModulePlugin.php @@ -1,6 +1,8 @@ dispatch(new GetCity($id))) { + return null; + } + + return $ad; + } + ), + new \Twig_SimpleFunction( + 'getCountry', + function ($id) { + + if (!$ad = $this->dispatch(new GetCountry($id))) { + return null; + } + return $ad; } ), diff --git a/addons/default/visiosoft/profile-module/src/Adress/Command/GetAddress.php b/addons/default/visiosoft/profile-module/src/Adress/Command/GetAddress.php new file mode 100644 index 000000000..03a326442 --- /dev/null +++ b/addons/default/visiosoft/profile-module/src/Adress/Command/GetAddress.php @@ -0,0 +1,34 @@ +id = $id; + } + + /** + * @param AdressRepositoryInterface $adressRepository + * @return \Anomaly\Streams\Platform\Model\EloquentModel|null + */ + public function handle(AdressRepositoryInterface $adressRepository) + { + if ($this->id) { + return $adressRepository->find($this->id); + } + return null; + } +} diff --git a/addons/default/visiosoft/profile-module/src/ProfileModulePlugin.php b/addons/default/visiosoft/profile-module/src/ProfileModulePlugin.php index 749ee3007..8f6e6a8cf 100644 --- a/addons/default/visiosoft/profile-module/src/ProfileModulePlugin.php +++ b/addons/default/visiosoft/profile-module/src/ProfileModulePlugin.php @@ -1,6 +1,7 @@ dispatch(new GetAddress($id))) { + return null; + } + return $ad; } )