xlabs/topsetbundle

Create manual rankings/top selection bundle

Installs: 484

Dependents: 1

Suggesters: 0

Security: 0

Type:symfony-bundle

1.0.8 2023-01-27 11:17 UTC

This package is auto-updated.

Last update: 2024-11-27 15:12:42 UTC


README

A redis driven result cache driver.

Installation

Install through composer:

php -d memory_limit=-1 composer.phar require xlabs/topsetbundle

In your AppKernel

public function registerbundles()
{
    return [
    	...
    	...
    	new XLabs\TopSetBundle\XLabsTopSetBundle(),
    ];
}

Routing

Append to main routing file:

# app/config/routing.yml
  
x_labs_top_set:
    resource: .
    type: xlabs_topset_routing

Configuration sample

Default values are shown below:

# app/config/config.yml
  
x_labs_top_set:
    # for firewall purposes; default is empty
    url_prefix: /members

Usage

You can access the top manager tool by using the following routing id:

xlabs_topset_manager

Check the manager main window; the plug icon will describe how to use it in the project.

Whenever you want an Entity to be reachable from the top manager, just include the following annotation in it:

namespace YourBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
...
use XLabs\TopSetBundle\Annotations as XLabsTopSet;

/**
 * @ORM\Entity
 * ...
 * @XLabsTopSet\Config(routeJSON="<your_routing_id>")
 */
class MyEntity
{
    ...
}

    $entries = array();
    ... get results ...
    ... loop begin ...
        $entries[$row['id']] = array(
            'id' => $row['id'],
            'title' => $row['title'],
            'image' => $row['image']
        );
    ... loop end ...
    return json_encode($entries);

The search in the Top Entries Manager form will be performed on the "title" attribute.