mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-09 23:06:08 -06:00
Merge pull request #185 from openclassify/basetheme
get Detail function on twig for Address and Location Module
This commit is contained in:
commit
82848794ab
@ -0,0 +1,34 @@
|
|||||||
|
<?php namespace Visiosoft\LocationModule\City\Command;
|
||||||
|
|
||||||
|
use Visiosoft\LocationModule\City\CityModel;
|
||||||
|
|
||||||
|
class GetCity
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var $id
|
||||||
|
*/
|
||||||
|
protected $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GetProduct constructor.
|
||||||
|
* @param $id
|
||||||
|
*/
|
||||||
|
public function __construct($id)
|
||||||
|
{
|
||||||
|
$this->id = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CityModel $groups
|
||||||
|
* @return |null
|
||||||
|
*/
|
||||||
|
public function handle(CityModel $groups)
|
||||||
|
{
|
||||||
|
if ($this->id) {
|
||||||
|
return $groups->find($this->id);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,33 @@
|
|||||||
|
<?php namespace Visiosoft\LocationModule\Country\Command;
|
||||||
|
|
||||||
|
use Visiosoft\LocationModule\Country\CountryModel;
|
||||||
|
|
||||||
|
class GetCountry
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var $id
|
||||||
|
*/
|
||||||
|
protected $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GetProduct constructor.
|
||||||
|
* @param $id
|
||||||
|
*/
|
||||||
|
public function __construct($id)
|
||||||
|
{
|
||||||
|
$this->id = $id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param CountryModel $groups
|
||||||
|
* @return |null
|
||||||
|
*/
|
||||||
|
public function handle(CountryModel $groups)
|
||||||
|
{
|
||||||
|
if ($this->id) {
|
||||||
|
return $groups->find($this->id);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,8 @@
|
|||||||
<?php namespace Visiosoft\LocationModule;
|
<?php namespace Visiosoft\LocationModule;
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
|
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
|
||||||
|
use Visiosoft\LocationModule\City\Command\GetCity;
|
||||||
|
use Visiosoft\LocationModule\Country\Command\GetCountry;
|
||||||
use Visiosoft\LocationModule\District\Command\GetDistrict;
|
use Visiosoft\LocationModule\District\Command\GetDistrict;
|
||||||
use Visiosoft\LocationModule\Neighborhood\Command\GetNeighborhood;
|
use Visiosoft\LocationModule\Neighborhood\Command\GetNeighborhood;
|
||||||
|
|
||||||
@ -32,6 +34,28 @@ class LocationModulePlugin extends Plugin
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $ad;
|
||||||
|
}
|
||||||
|
),
|
||||||
|
new \Twig_SimpleFunction(
|
||||||
|
'getCity',
|
||||||
|
function ($id) {
|
||||||
|
|
||||||
|
if (!$ad = $this->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;
|
return $ad;
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
|
|||||||
@ -0,0 +1,34 @@
|
|||||||
|
<?php namespace Visiosoft\ProfileModule\Adress\Command;
|
||||||
|
|
||||||
|
|
||||||
|
use Visiosoft\ProfileModule\Adress\Contract\AdressRepositoryInterface;
|
||||||
|
|
||||||
|
class GetAddress
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var $id
|
||||||
|
*/
|
||||||
|
protected $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GetProduct constructor.
|
||||||
|
* @param $id
|
||||||
|
*/
|
||||||
|
public function __construct($id)
|
||||||
|
{
|
||||||
|
$this->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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
<?php namespace Visiosoft\ProfileModule;
|
<?php namespace Visiosoft\ProfileModule;
|
||||||
|
|
||||||
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
|
use Anomaly\Streams\Platform\Addon\Plugin\Plugin;
|
||||||
|
use Visiosoft\ProfileModule\Adress\Command\GetAddress;
|
||||||
use Visiosoft\ProfileModule\Profile\Command\FindUserProfile;
|
use Visiosoft\ProfileModule\Profile\Command\FindUserProfile;
|
||||||
|
|
||||||
class ProfileModulePlugin extends Plugin
|
class ProfileModulePlugin extends Plugin
|
||||||
@ -20,6 +21,17 @@ class ProfileModulePlugin extends Plugin
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $ad;
|
||||||
|
}
|
||||||
|
),
|
||||||
|
new \Twig_SimpleFunction(
|
||||||
|
'getAddress',
|
||||||
|
function ($id) {
|
||||||
|
|
||||||
|
if (!$ad = $this->dispatch(new GetAddress($id))) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return $ad;
|
return $ad;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user