CreateAdminController
extends BaseConsole
in package
RdbAdmin create an admin controller CLI.
Tags
Table of Contents
Properties
- $Fs : FileSystem
Methods
- configure() : void
- {@inheritDoc}
- execute() : int
- {@inheritDoc}
- copyFile() : bool
- Copy file.
- createControllerParentFolderIfNotExists() : bool
- Create controller parent folder if not exists.
- prepareFileName() : string
- Prepare file name related from "Modules" folder.
- rewriteContents() : bool
- Rewrite file contents.
Properties
$Fs
private
FileSystem
$Fs
Methods
configure()
{@inheritDoc}
protected
configure() : void
execute()
{@inheritDoc}
protected
execute(InputInterface $Input, OutputInterface $Output) : int
Parameters
- $Input : InputInterface
- $Output : OutputInterface
Return values
intcopyFile()
Copy file.
private
copyFile(string $sourceFile, string $controllerFullPath, OutputInterface $Output, SymfonyStyle $Io) : bool
Parameters
- $sourceFile : string
-
Full path to source file.
- $controllerFullPath : string
-
Full path to new controller name.
- $Output : OutputInterface
- $Io : SymfonyStyle
Return values
bool —Return true
on success, false
for otherwise.
createControllerParentFolderIfNotExists()
Create controller parent folder if not exists.
private
createControllerParentFolderIfNotExists(string $controllerRelatePath, OutputInterface $Output, SymfonyStyle $Io) : bool
Parameters
- $controllerRelatePath : string
-
Controller related path that has got from
prepareFileName()
method. - $Output : OutputInterface
- $Io : SymfonyStyle
Return values
bool —Return true
if created successfully or folder is already exists, return false
if failed to create.
prepareFileName()
Prepare file name related from "Modules" folder.
private
prepareFileName(string $moduleName, string $controllerName) : string
Parameters
- $moduleName : string
-
The module name.
- $controllerName : string
-
The controller name without suffix and extension.
Return values
string —Return related path to controller from Modules folder.
rewriteContents()
Rewrite file contents.
private
rewriteContents(string $moduleName, string $controllerRelatePath, OutputInterface $Output, SymfonyStyle $Io) : bool
Parameters
- $moduleName : string
-
The module folder name.
- $controllerRelatePath : string
-
Controller relate path that has got from
prepareFileName()
method. - $Output : OutputInterface
- $Io : SymfonyStyle
Return values
bool —Return true
on success, false
on failure.