PHP code example of tourze / tag-manage-bundle

1. Go to this page and download the library: Download tourze/tag-manage-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/ */

    

tourze / tag-manage-bundle example snippets


return [
    // ...
    Tourze\TagManageBundle\TagManageBundle::class => ['all' => true],
];

use Tourze\TagManageBundle\Entity\Tag;
use Tourze\TagManageBundle\Entity\TagGroup;

// Create tag group
$group = new TagGroup();
$group->setName('Technology');

// Create tag
$tag = new Tag();
$tag->setName('PHP');
$tag->setGroups($group);
$tag->setValid(true);

use Tourze\TagManageBundle\Repository\TagRepository;
use Tourze\TagManageBundle\Repository\TagGroupRepository;

// Tag queries
$tags = $tagRepository->findBy(['valid' => true], ['name' => 'ASC']);
$tag = $tagRepository->findOneBy(['name' => 'PHP']);

// Tag group queries
$groups = $tagGroupRepository->findAll();
$group = $tagGroupRepository->findOneBy(['name' => 'Technology']);
bash
php bin/console doctrine:migrations:migrate
json
{
  "jsonrpc": "2.0",
  "result": {
    "list": [
      {
        "id": 1,
        "name": "PHP",
        "valid": true,
        "group": {
          "id": "1234567890123456789",
          "name": "Technology"
        },
        "createTime": "2024-01-01 12:00:00",
        "updateTime": "2024-01-01 12:00:00",
        "usageCount": 156,
        "lastUsedTime": "2024-01-15 10:30:00"
      }
    ],
    "pagination": {
      "current": 1,
      "pageSize": 20,
      "total": 100,
      "hasMore": true
    }
  },
  "id": 1
}