create coutry events

This commit is contained in:
Manuel Raynaud
2013-10-07 10:50:44 +02:00
parent f408ad5d1f
commit 51a307527c
9 changed files with 529 additions and 32 deletions

View File

@@ -0,0 +1,154 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event\Country;
/**
* Class CountryCreateEvent
* @package Thelia\Core\Event\Country
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class CountryCreateEvent extends CountryEvent
{
protected $locale;
protected $title;
protected $isocode;
protected $isoAlpha2;
protected $isoAlpha3;
/**
* @var int area zone
*/
protected $area;
/**
* @param mixed $isoAlpha2
*/
public function setIsoAlpha2($isoAlpha2)
{
$this->isoAlpha2 = $isoAlpha2;
return $this;
}
/**
* @return mixed
*/
public function getIsoAlpha2()
{
return $this->isoAlpha2;
}
/**
* @param mixed $isoAlpha3
*/
public function setIsoAlpha3($isoAlpha3)
{
$this->isoAlpha3 = $isoAlpha3;
return $this;
}
/**
* @return mixed
*/
public function getIsoAlpha3()
{
return $this->isoAlpha3;
}
/**
* @param mixed $isocode
*/
public function setIsocode($isocode)
{
$this->isocode = $isocode;
return $this;
}
/**
* @return mixed
*/
public function getIsocode()
{
return $this->isocode;
}
/**
* @param mixed $locale
*/
public function setLocale($locale)
{
$this->locale = $locale;
return $this;
}
/**
* @return mixed
*/
public function getLocale()
{
return $this->locale;
}
/**
* @param mixed $title
*/
public function setTitle($title)
{
$this->title = $title;
return $this;
}
/**
* @return mixed
*/
public function getTitle()
{
return $this->title;
}
/**
* @param int $area
*/
public function setArea($area)
{
$this->area = $area;
return $this;
}
/**
* @return int
*/
public function getArea()
{
return $this->area;
}
}

View File

@@ -0,0 +1,60 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event\Country;
/**
* Class CountryDeleteEvent
* @package Thelia\Core\Event\Country
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class CountryDeleteEvent extends CountryEvent
{
/**
* @var int country id
*/
protected $country_id;
function __construct($country_id)
{
$this->country_id = $country_id;
}
/**
* @param int $country_id
*/
public function setCountryId($country_id)
{
$this->country_id = $country_id;
}
/**
* @return int
*/
public function getCountryId()
{
return $this->country_id;
}
}

View File

@@ -0,0 +1,73 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event\Country;
use Thelia\Core\Event\ActionEvent;
use Thelia\Model\Country;
/**
* Class CountryEvent
* @package Thelia\Core\Event\Country
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class CountryEvent extends ActionEvent
{
/*
* @var \Thelia\Model\Country
*/
protected $country;
function __construct(Country $country)
{
$this->country = $country;
}
/**
* @param mixed $country
*/
public function setCountry(Country $country)
{
$this->country = $country;
return $this;
}
/**
* @return null|\Thelia\Model\Country
*/
public function getCountry()
{
return $this->country;
}
/**
* @return bool
*/
public function hasCountry()
{
return null !== $this->country;
}
}

View File

@@ -0,0 +1,35 @@
<?php
/*************************************************************************************/
/* */
/* Thelia */
/* */
/* Copyright (c) OpenStudio */
/* email : info@thelia.net */
/* web : http://www.thelia.net */
/* */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 3 of the License */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/*************************************************************************************/
namespace Thelia\Core\Event\Country;
/**
* Class CountryUpdateEvent
* @package Thelia\Core\Event\Country
* @author Manuel Raynaud <mraynaud@openstudio.fr>
*/
class CountryUpdateEvent extends CountryCreateEvent
{
}

View File

@@ -183,8 +183,6 @@ final class TheliaEvents
const FOLDER_TOGGLE_VISIBILITY = "action.toggleFolderVisibility";
const FOLDER_UPDATE_POSITION = "action.updateFolderPosition";
// const FOLDER_ADD_CONTENT = "action.categoryAddContent";
// const FOLDER_REMOVE_CONTENT = "action.categoryRemoveContent";
const BEFORE_CREATEFOLDER = "action.before_createFolder";
const AFTER_CREATEFOLDER = "action.after_createFolder";
@@ -216,6 +214,24 @@ final class TheliaEvents
const BEFORE_UPDATECONTENT = "action.before_updateContent";
const AFTER_UPDATECONTENT = "action.after_updateContent";
// -- country management -----------------------------------------------
const COUNTRY_CREATE = "action.createCountry";
const COUNTRY_UPDATE = "action.updateCountry";
const COUNTRY_DELETE = "action.deleteCountry";
const COUNTRY_TOGGLE_VISIBILITY = "action.toggleCountryVisibility";
//const COUNTRY_UPDATE_POSITION = "action.updateFolderPosition";
const BEFORE_CREATECOUNTRY = "action.before_createCountry";
const AFTER_CREATECOUNTRY = "action.after_createCountry";
const BEFORE_DELETECOUNTRY = "action.before_deleteCountry";
const AFTER_DELETECOUNTRY = "action.after_deleteCountry";
const BEFORE_UPDATECOUNTRY = "action.before_updateCountry";
const AFTER_UPDATECOUNTRY = "action.after_updateCountry";
// -- Categories Associated Content ----------------------------------------
const BEFORE_CREATECATEGORY_ASSOCIATED_CONTENT = "action.before_createCategoryAssociatedContent";