Skip to content

Commit

Permalink
add get time and date
Browse files Browse the repository at this point in the history
  • Loading branch information
noumo committed May 28, 2015
1 parent 0185bc0 commit b414fe6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions modules/article/api/ArticleObject.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace yii\easyii\modules\article\api;

use Yii;
use yii\easyii\components\API;
use yii\easyii\models\Photo;
use yii\easyii\modules\article\models\Item;
Expand All @@ -15,6 +16,8 @@ class ArticleObject extends \yii\easyii\components\ApiObject

public $views;

public $time;

/** @var int */
public $category_id;

Expand All @@ -40,6 +43,10 @@ public function getTags(){
return $this->model->tagsArray;
}

public function getDate(){
return Yii::$app->formatter->asDate($this->time);
}

public function getPhotos()
{
if(!$this->_photos){
Expand Down
7 changes: 6 additions & 1 deletion modules/catalog/api/ItemObject.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace yii\easyii\modules\catalog\api;

use yii\data\ActiveDataProvider;
use Yii;
use yii\easyii\components\API;
use yii\easyii\models\Photo;
use yii\easyii\modules\catalog\models\Item;
Expand All @@ -15,6 +15,7 @@ class ItemObject extends \yii\easyii\components\ApiObject
public $category_id;
public $available;
public $discount;
public $time;

private $_photos;

Expand All @@ -38,6 +39,10 @@ public function getOldPrice(){
return $this->model->price;
}

public function getDate(){
return Yii::$app->formatter->asDate($this->time);
}

public function getPhotos()
{
if(!$this->_photos){
Expand Down

0 comments on commit b414fe6

Please sign in to comment.