コード例 #1
0
 /**
  * Create shopping list form
  *
  * @Route("/create", name="orob2b_shopping_list_frontend_create")
  * @Template("OroB2BShoppingListBundle:ShoppingList/Frontend:update.html.twig")
  * @Acl(
  *      id="orob2b_shopping_list_frontend_create",
  *      type="entity",
  *      class="OroB2BShoppingListBundle:ShoppingList",
  *      permission="CREATE",
  *      group_name="commerce"
  * )
  *
  * @return array|RedirectResponse
  */
 public function createAction()
 {
     $shoppingList = new ShoppingList();
     /** @var AccountUser $accountUser */
     $accountUser = $this->getUser();
     $shoppingList->setOwner($accountUser)->setOrganization($accountUser->getOrganization())->setAccount($accountUser->getCustomer())->setAccountUser($accountUser);
     return $this->update($shoppingList);
 }
コード例 #2
0
 /**
  * @param ObjectManager $manager
  * @param AccountUser   $accountUser
  * @param string        $label
  *
  * @return ShoppingList
  */
 protected function createShoppingList(ObjectManager $manager, AccountUser $accountUser, $label)
 {
     $shoppingList = new ShoppingList();
     $shoppingList->setOwner($accountUser);
     $shoppingList->setOrganization($accountUser->getOrganization());
     $shoppingList->setAccountUser($accountUser);
     $shoppingList->setAccount($accountUser->getCustomer());
     $shoppingList->setNotes('Some notes for ' . $label);
     $shoppingList->setLabel($label);
     $manager->persist($shoppingList);
 }
コード例 #3
0
 /**
  * @param ObjectManager $manager
  * @param string        $name
  * @param AccountUser   $accountUser
  *
  * @return ShoppingList
  */
 protected function createShoppingList(ObjectManager $manager, AccountUser $accountUser, $name)
 {
     $shoppingList = new ShoppingList();
     $shoppingList->setOwner($accountUser);
     $shoppingList->setOrganization($accountUser->getOrganization());
     $shoppingList->setAccountUser($accountUser);
     $shoppingList->setAccount($accountUser->getCustomer());
     $shoppingList->setLabel($name . '_label');
     $shoppingList->setNotes($name . '_notes');
     $manager->persist($shoppingList);
     $this->addReference($name, $shoppingList);
     return $shoppingList;
 }