counting stuff
This commit is contained in:
parent
e76d6ec225
commit
922fa73e94
@ -36,6 +36,8 @@
|
||||
{% endif %}" href="{{ path('productcategory_index') }}">
|
||||
<i class="fa fa-file-archive-o"></i>
|
||||
Catégories
|
||||
|
||||
{{ app.user.categories|length }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
@ -46,6 +48,7 @@
|
||||
{% endif %}" href="{{ path('product_index') }}" data-toggle="tab">
|
||||
<i class="fa fa-gears"></i>
|
||||
Produits
|
||||
{{ app.user.products|length }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
@ -57,6 +60,7 @@
|
||||
data-toggle="tab">
|
||||
<i class="fa fa-th-large"></i>
|
||||
Festivals
|
||||
{{ app.user.festivals|length }}
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
|
@ -378,14 +378,22 @@ class DefaultController extends Controller {
|
||||
'base_dir' => '',
|
||||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* @Route("/mass-create", name="mass_create")
|
||||
*/
|
||||
public function massCreateAction() {
|
||||
public function massCreateAction( Request $request ) {
|
||||
$currentUser = $this->getUser();
|
||||
$m = $this->getDoctrine()->getManager();
|
||||
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
|
||||
$mySellings = $sellingRepo->findByUser( $currentUser->getId() );
|
||||
$myCategories = $sellingRepo->findByUser( $currentUser->getId() );
|
||||
|
||||
if ( $request->getMethod() == 'POST' ) {
|
||||
|
||||
var_dump( nl2br($request->request->get( 'produits' )) );
|
||||
// check with existing categories and products, sort them by name.
|
||||
// save all
|
||||
}
|
||||
|
||||
return $this->render( 'logged/import.html.twig',
|
||||
[
|
||||
|
@ -39,16 +39,19 @@ class ProductCategoryController extends Controller {
|
||||
*/
|
||||
public function newAction( Request $request ) {
|
||||
$productCategory = new Productcategory();
|
||||
$productCategory->setUsers($this->getUser());
|
||||
$currentUser = $this->getUser();
|
||||
$currentUser->addCategory( $productCategory );
|
||||
$productCategory->setUsers( [ $currentUser ] );
|
||||
$form = $this->createForm( 'AppBundle\Form\ProductCategoryType', $productCategory );
|
||||
$form->handleRequest( $request );
|
||||
|
||||
if ( $form->isSubmitted() && $form->isValid() ) {
|
||||
$em = $this->getDoctrine()->getManager();
|
||||
$em->persist( $productCategory );
|
||||
$em->persist( $currentUser );
|
||||
$em->flush();
|
||||
|
||||
return $this->redirectToRoute( 'productcategory_show', [ 'id' => $productCategory->getId() ] );
|
||||
return $this->redirectToRoute( 'productcategory_index' );
|
||||
}
|
||||
|
||||
return $this->render( 'productcategory/new.html.twig',
|
||||
|
Loading…
Reference in New Issue
Block a user