PHP code example of knplabs / rad-prototype

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

    

knplabs / rad-prototype example snippets


class AppKernel
{
    function registerBundles()
    {
        $bundles = array(
            //...
            new Knp\Rad\Prototype\Bundle\PrototypeBundle(),
            //...
        );

        //...

        return $bundles;
    }
}

namespace AppBundle\Controller;

use Knp\Rad\Prototype\Prototype;

class ProductController implements Prototype
{
    use Prototype\Controller;

    public function testAction($id) 
    {
        $product = $this->getRepository('AppBundle:Product')->find($id);

        $this->persist($product);
        $this->flush();

        // ...
    }
}