src/Flowcode/ShopBundle/Controller/InventoryController.php
/**
     * Displays a form to create a new Inventory entity.
     *
     * @Route("/new", name="stock_inventory_new")
     * @Method("GET")
     * @Template()
     */
Displays a form to create a new Inventory entity.
Displays a form to create a new Inventory entity .
public function newAction()
    {
        $inventory = new Inventory();
        $today = new \DateTime();;
        $inventory->setDate($today);
        $inventory->setUser($this->getUser());
        $inventory->setStatus(Inventory::STATUS_DRAFT);
        $defaultCode = $this->getInventoryService()->getNextCode();
        $inventory->setCode($defaultCode);
        $defaultName = $this->get('translator')->trans('default_name', [
            "%date%" => $today->format('d/m/y'),
        ], 'Inventory');
        $inventory->setName($defaultName);
        $form = $this->createForm(new InventoryType(), $inventory);
        return array(
            'inventory' => $inventory,
            'form' => $form->createView(),
        );
    }
public function newAction ( ) { $ inventory = new Inventory ( ) ; $ today = new \ DateTime ( ) ; ; $ inventory -> setDate ( $ today ) ; $ inventory -> setUser ( $ this -> getUser ( ) ) ; $ inventory -> setStatus ( Inventory :: STATUS_DRAFT ) ; $ defaultCode = $ this -> getInventoryService ( ) -> getNextCode ( ) ; $ inventory -> setCode ( $ defaultCode ) ; $ defaultName = $ this -> get ( 'translator' ) -> trans ( 'default_name' , [ " %date% " => $ today -> format ( 'd/m/y' ) , ] , 'Inventory' ) ; $ inventory -> setName ( $ defaultName ) ; $ form = $ this -> createForm ( new InventoryType ( ) , $ inventory ) ; return array ( 'inventory' => $ inventory , 'form' => $ form -> createView ( ) , ) ; }
Displays a form to create a new Inventory entity.
Displays a form to create a new Inventory entity .