xlabs / topsetbundle
Create manual rankings/top selection bundle
1.0.8
2023-01-27 11:17 UTC
Requires
- php: >=5.3.9
- symfony/symfony: >=3.4
Requires (Dev)
- symfony/expression-language: ~2.4|~3.0.0
- symfony/var-dumper: ~2.7.16|~2.8.9|~3.0.9
Suggests
- symfony/routing: For using the RoutingExtension
- symfony/var-dumper: For using the DumpExtension
- symfony/yaml: For using the YamlExtension
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.