PHP code example of tourze / train-category-bundle
1. Go to this page and download the library: Download tourze/train-category-bundle library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Tourze\TrainCategoryBundle\Service\CategoryValidationService;
class CustomValidationService extends CategoryValidationService
{
public function validateCustomRule(Category $category): array
{
$errors = [];
// 自定义验证逻辑
return $errors;
}
}
use Tourze\TrainCategoryBundle\Service\CategorySearchService;
class CustomSearchService extends CategorySearchService
{
public function searchByCustomCriteria(array $criteria): array
{
// 自定义搜索逻辑
return $this->categoryRepository->findBy($criteria);
}
}