[FIX] add namespaces

This commit is contained in:
Tony Air 2018-04-21 11:29:32 +07:00
parent 042d368c3d
commit e3b3c1f982
12 changed files with 41 additions and 21 deletions

View File

@ -1,3 +1,3 @@
SilverStripe\SiteConfig\SiteConfig: SilverStripe\SiteConfig\SiteConfig:
extensions: extensions:
- SiteConfigExtension - Site\Extensions\SiteConfigExtension

View File

@ -2,7 +2,7 @@
# with all configuration variables presented # with all configuration variables presented
# Cuz WebPack compiling script use it to set configuration # Cuz WebPack compiling script use it to set configuration
WebpackTemplateProvider: Site\Templates\WebpackTemplateProvider:
SRC: site/client/src SRC: site/client/src
DIST: site/client/dist DIST: site/client/dist
HOSTNAME: localhost HOSTNAME: localhost

View File

@ -1,5 +1,7 @@
<?php <?php
namespace Site\Extensions;
use SilverStripe\ORM\DataExtension; use SilverStripe\ORM\DataExtension;
use SilverStripe\CMS\Model\SiteTree; use SilverStripe\CMS\Model\SiteTree;
use SilverStripe\Forms\FieldList; use SilverStripe\Forms\FieldList;

View File

@ -1,5 +1,8 @@
<?php <?php
namespace Site\Pages;
use Page;
class HomePage extends Page class HomePage extends Page
{ {
} }

View File

@ -1,5 +1,8 @@
<?php <?php
namespace Site\Pages;
use PageController;
class HomePageController extends PageController class HomePageController extends PageController
{ {
} }

11
site/src/Pages/Page.php Executable file
View File

@ -0,0 +1,11 @@
<?php
// vendor/silverstripe/errorpage/src/ErrorPage.php
// extends global Page class
//namespace Site\Pages;
use SilverStripe\CMS\Model\SiteTree;
class Page extends SiteTree
{
}

View File

@ -0,0 +1,11 @@
<?php
// vendor/silverstripe/errorpage/src/ErrorPageController.php
// extends global PageController class
//namespace Site\Pages;
use SilverStripe\CMS\Controllers\ContentController;
class PageController extends ContentController
{
}

View File

@ -1,7 +0,0 @@
<?php
use SilverStripe\CMS\Model\SiteTree;
class Page extends SiteTree
{
}

View File

@ -1,7 +0,0 @@
<?php
use SilverStripe\CMS\Controllers\ContentController;
class PageController extends ContentController
{
}

View File

@ -1,5 +1,7 @@
<?php <?php
namespace Site\Templates;
use SilverStripe\View\TemplateGlobalProvider; use SilverStripe\View\TemplateGlobalProvider;
use SilverStripe\View\Requirements; use SilverStripe\View\Requirements;
use SilverStripe\Core\Config\Config; use SilverStripe\Core\Config\Config;

View File

@ -4,6 +4,8 @@
* Directs assets requests to Webpack server or to static files * Directs assets requests to Webpack server or to static files
*/ */
namespace Site\Templates;
use SilverStripe\View\TemplateGlobalProvider; use SilverStripe\View\TemplateGlobalProvider;
use SilverStripe\View\Requirements; use SilverStripe\View\Requirements;
use SilverStripe\Control\Director; use SilverStripe\Control\Director;

View File

@ -2,9 +2,9 @@
* Load webpack configuration from site/_config/webpack.yml * Load webpack configuration from site/_config/webpack.yml
*/ */
const path = require("path"); const path = require('path');
const fs = require("fs"); const fs = require('fs');
const yaml = require("js-yaml"); const yaml = require('js-yaml');
const conf = yaml.safeLoad(fs.readFileSync(path.join(__dirname, "site/_config/webpack.yml"), "utf8")); const conf = yaml.safeLoad(fs.readFileSync(path.join(__dirname, 'site/_config/webpack.yml'), 'utf8'));
module.exports = conf.WebpackTemplateProvider; module.exports = conf['Site\\Templates\\WebpackTemplateProvider'];