Skip to content

Commit 0b212f4

Browse files
author
Andrew Welch
committed
* Added console command scaffolding
1 parent 6b99c5b commit 0b212f4

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

src/Transcoder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ public function init()
4444
parent::init();
4545
self::$plugin = $this;
4646

47+
// Handle console commands
48+
if (Craft::$app instanceof ConsoleApplication) {
49+
$this->controllerNamespace = 'nystudio107\transcoder\console\controllers';
50+
}
51+
4752
// Add the Transcoder path to the list of things the Clear Caches tool can delete.
4853
Event::on(
4954
ClearCaches::className(),
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
<?php
2+
/**
3+
* Transcoder plugin for Craft CMS 3.x
4+
*
5+
* Transcoder
6+
*
7+
* @link https://nystudio107.com
8+
* @copyright Copyright (c) 2017 Transcoder
9+
*/
10+
11+
namespace nystudio107\transcoder\console\controllers;
12+
13+
use nystudio107\transcoder\Transcoder;
14+
15+
use Craft;
16+
use yii\console\Controller;
17+
use yii\helpers\Console;
18+
19+
/**
20+
* Default Command
21+
*
22+
* @author Transcoder
23+
* @package Transcoder
24+
* @since 1.0.0
25+
*/
26+
class DefaultController extends Controller
27+
{
28+
// Public Methods
29+
// =========================================================================
30+
31+
/**
32+
* Handle transcoder/default console commands
33+
*
34+
* @return mixed
35+
*/
36+
public function actionIndex()
37+
{
38+
$result = 'something';
39+
40+
echo "Welcome to the console DefaultController actionIndex() method\n";
41+
42+
return $result;
43+
}
44+
45+
/**
46+
* Handle transcoder/default/do-something console commands
47+
*
48+
* @return mixed
49+
*/
50+
public function actionDoSomething()
51+
{
52+
$result = 'something';
53+
54+
echo "Welcome to the console DefaultController actionDoSomething() method\n";
55+
56+
return $result;
57+
}
58+
}

0 commit comments

Comments
 (0)