PHP code example of ggggino / recenty-bundle

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

    

ggggino / recenty-bundle example snippets


use GGGGino\RecentyBundle\WrapperManager;

/**
 * @Route("/default", name="default")
 */
public function index(WrapperManager $wrapperManager): Response
{
    $strategies = $wrapperManager->getStrategies();
    
    /** @var Product $product */
    $product = $em->getRepository(Product::class)->find(1);

    try {
        $wrapperManager->increment('main', new WrapperGenericEntity($product, 'bought', 2));
    } catch (EntityNotValidException $e) {
        return $this->json([
            'message' => 'Wrapper not generable!'
        ], 500);
    }
    
    return $this->json([
        'message' => 'Welcome to your new controller!'
    ]);
}