画布 1
dictionary-frontend-oa
  Adapter
    Category
      CategoryRestfulAdapter.class.php
        extends
          GuzzleAdapter
        implements
          ICategoryAdapter
        use
          AsyncFetchAbleRestfulAdapterTrait
          FetchAbleRestfulAdapterTrait
        private
          $translator
          $resource
        methods
          protected function getTranslator()
            return $this->translator
          protected function getResource()
            return $this->resource
          public function scenario($scenario)
          public function fetchOne($id)
            return $this->fetchOneAction($id, new NullCategory())
          public function add(Category $category)
          public function edit(Category $category)
      ICategoryAdapter
        extends
          IFetchAbleAdapter
          IAsyncAdapter
    Dictionary
  Command
    Category
      AddCategoryCommand.class.php
        implements
          ICommand
        parameters
          $id
            public
            int
          $name
            public
            string
          $parentId
            public
            int
          $code
            public
            int
      EditCategoryCommand.class.php
        implements
          ICommand
        parameters
          $id
            public
            int
          $name
            public
            string
          $code
            public
            int
    Dictionary
  CommandHandler
    Category
      AddCategoryCommandHandler
        implements
          ICommandHandler
        parameters
          $category
        methods
          public function __construct()
            $this->category = new Category()
          public function __destruct()
            unset($this->category)
          protected function getCategory()
            return $this->category
          public function execute(ICommand $command)
            return $this->executeAction($command)
          protected function executeAction($command)
            return $category->add()
      EditCategoryCommandHandler
        implements
          ICommandHandler
        parameters
          $repository
          $category
        methods
          public function __construct()
            $this->repository = new CategoryRepository()
            $this->category = new NullCategory()
          public function __destruct()
            unset($this->repository)
            unset($this->category)
          protected function getRepository()
            return $this->repository
          protected function getCategory()
            return $this->category
          protected function fetchCategory($id)
            return $this->getRepository()->fetchOne($id)
          public function execute(ICommand $command)
            return $this->executeAction($command)
          protected function executeAction($command)
            return $this->category->edit()
  Controller
    Category
      FetchController.class.php
        use
          FetchControllerTrait
        implements
          IFetchAbleController
        parameters
          $repository
          $category
        methods
          public function __construct()
            $this->repository = new CategoryRepository()
            $this->category = new Category()
          public function __destruct()
            unset($this->repository)
            unset($this->category)
          protected getRepository()
            return $this->repository
          protected getCategory()
            return $this->category
          protected function filterAction()
            路由
              /categories
            请求方式
              GET
            返回值
            parameters
              $size
              $page
              $sort
              $filter
            $parentList=$this->getRepository()->search($filter, $sort, $page, $size)
            返回结果
              $this->getResponse()->view(new CategoryListView($categoryList, $count, $parentList))->render()
              $this->displayError()
          private function getParentInfo($categoryList)
            return $parentList;
          protected function filterFormatChange($sort, $search)
            return [$filter, $sort];
          protected function fetchOneAction(int $id)
            路由
              /categories{id:\d+}
            请求方式
              GET
            返回值
            parameters
              $id
                int
            $category = $this->getRepository()->fetchOne($id)
            if ($category instanceof INull)
              return false
            $this->getResponse()->view(new CategoryView($category, $parent))->render()
              return true
          protected function validatePurview()
            return $this->getDictionary()->isColumnBelongToMyUserGroup();
      OperationController.class.php
        extends
          Controller
        implements
          IOperatAbleController
        use
          OperatControllerTrait
        parameters
          $commandBus
          $repository
        methods
          public function __construct()
            $this->commandBus = new CommandBus(new CategoryCommandHandlerFactory())
            $this->repository = new CategoryRepository()
            $this->dictionaryInputWidgetRules = new DictionaryInputWidgetRules()
          public function __destruct
            unset($this->commandBus)
            unset($this->repository)
            unset($this->dictionaryInputWidgetRules)
          protected function getCommandBus()
            return $this->commandBus
          protected function getRepository()
            rerurn $this->repository
          protected function getDictionaryInputWidgetRules()
            return $this->dictionaryInputWidgetRules
          protected function addView()
            $this->getRepository()->scenario(CategoryRepository::LIST_MODEL_UN) ->search(array(), $sort)
            $this->getResponse()->view(new GetCategoryListView($categoryList))->render()
          protected function addAction()
            true
              $command = new AddCategoryCommand()
                if ($this->getCommandBus()->send($command))
                  true
                    $this->displaySuccess();
                    return true;
                  false
                    $this->displayError();
                    return false;
            false
              $this->displayError();
              return false;
          protected function editView(int $id)
            $this->getRepository()->scenario(CategoryRepository::FETCH_ONE_MODEL_UN)->fetchOne($id)
            $this->getRepository()->scenario(CategoryRepository::FETCH_ONE_MODEL_UN)->fetchOne($category->getParentId())
            $this->getResponse()->view(new CategoryView($category, $parent))->render()
          protected function editAction(int $id)
            if ($this->validateEditScenario($name, $code))
              $command = new EditCategoryCommand($name, $code, $id)
                if ($this->getCommandBus()->send($command))
            $this->displayError()
              return false
          protected function validateEditScenario($name, $code)
            return $this->getDictionaryInputWidgetRules()->name($name)&& $this->getDictionaryInputWidgetRules()->code($code)
          protected function validateAddScenario($name,$code,$parentId）
            子主题 1
              return $this->getDictionaryInputWidgetRules()->isCodeNotExist($code)
              && $this->getDictionaryInputWidgetRules()->name($name)
              && $this->getDictionaryInputWidgetRules()->code($code)
              && $this->getDictionaryInputWidgetRules()->parentId($parentId);
    Dictionary
        FetchController.class.php
          use
            FetchControllerTrait
          implements
            IFetchAbleController
          parameters
            $repository
            $category
          methods
            public function __construct()
              $this->repository = new CategoryRepository()
              $this->category = new Category()
            public function __destruct()
              unset($this->repository)
              unset($this->category)
            protected getRepository()
              return $this->repository
            protected getCategory()
              return $this->category
            protected function filterAction()
              路由
                /categories
              请求方式
                GET
              返回值
              parameters
                $size
                $page
                $sort
                $filter
              $parentList=$this->getRepository()->search($filter, $sort, $page, $size)
              返回结果
                $this->getResponse()->view(new CategoryListView($categoryList, $count, $parentList))->render()
                $this->displayError()
            private function getParentInfo($categoryList)
              return $parentList;
            protected function filterFormatChange($sort, $search)
              return [$filter, $sort];
            protected function fetchOneAction(int $id)
              路由
                /categories{id:\d+}
              请求方式
                GET
              返回值
              parameters
                $id
                  int
              $category = $this->getRepository()->fetchOne($id)
              if ($category instanceof INull)
                return false
              $this->getResponse()->view(new CategoryView($category, $parent))->render()
                return true
            protected function validatePurview()
              return $this->getDictionary()->isColumnBelongToMyUserGroup();
      OperationController.class.php
  Model
    Category.class.php
      implements
        IObject
        IPurviewAble
      use
        Object
        PurviewAbleTrait
      parameters
        $id
          private
          int
          类别Id
        $name
          private
          string
          类别名称
        $parentId
          private
          int
          父级id
        $code
          private
          string
          编号
        $categoryRepository
          private
      methods
        public function __construct
        public function __destruct()
        public function getId()
          return $this->id
        public function getName()
          return $this->name
        public function getParentId()
          return $this->parentId
        public funciton getCode
          return $this->code
        protected function getCategoryRepository()
          return $this->categoryRepository
        public function add()
          return $this->getCategoryRepository()->add($this)
        public function edit()
          return $this->getCategoryRepository()->edit($this)
        public function getColumn()
          return IPurviewAble::COLUMN['SYSTEM_MANAGE']
        public function isPermit()
          return Core::$container->get('user')->getUserGroup()->getId() == IPurviewAble::DRC_USER_GROUP_ID
    Dictionary.class.php
    NullCategory.class.php
      extends
        Category
      implements
        INull
      private
        $instance
          static
      methods
        private function resourceNotExist()
        public function add()
          return $this->resourceNotExist();
        public function edit()
          return $this->resourceNotExist();
    NullDictionary.class.php
  Repository
    Category
      CategoryRepository.class.php
        implements
          ICategoryAdapter
        use
          FetchRepositoryTrait
          AsyncRepositoryTrait
        parameters
          $adapter
        methods
          public function __construct()
            $this->adapter = new CategoryRestfulAdapter();
          public function scenario($scenario)
            return $this->getAdapter()->scenario($scenario)
          protected function getAdapter()
            return $this->adapter
          public function add(Category $category)
            return $this->getAdapter()->add($category)
          public function edit(Category $category)
            return $this->getAdapter()->edit($category)
    Dictionary
  Translator
    CategoryTranslator.class.php
    CategoryRestfulTranslator.class.php
  View
    CategoryListView.class.php
      extends
        JsonView
      implements
        IView
      parameters
        category
        $count
        $parentList
        $translator
      methods
        public function __construct
        protected function getCategory()
          return $this->category
        protected function getCount()
          return $this->count
        protected function getParentList()
          return $this->parentList
        protected function getTranslator()
          return $this->translator
        public function render()
    CategoryView.class.php
      extends
        JsonView
      implements
        IView
      parameters
        $category
        $translator
        $parent
      methods
        public function __construct(Category $category, Category $parent)
          $this->category = $category
          $this->parent = $parent
          $this->translator = new CategoryTranslator()
        protected function getCategory()
          return $this->category
        protected function getTranslator()
          return $this->translator
        protected function getParent()
          return $this->parent
        public function render()
    GetCategoryListView.class.php
      extends
        JsonView
      implements
        IView
      parameters
        $category
        $translator
      methods
        public function __construct()
        protected function getCategory()
          return $this->category
        protected function getTranslator()
          return $this->translator
        public function render()
$command->name
$command->parentId
$command->code
$command->id
$command->name
$command->code
$name
$parentId,
$code