Symfony

9

Solutions

21

Contributors

Symfony is a PHP web application framework for MVC applications. Symfony provides an architecture, components and tools for developers to build complex web applications faster. Symfony is aimed at building robust applications in an enterprise context by speeding up the creation and maintenance of web applications and replacing repetitive coding tasks. It has a low performance overhead used with a bytecode cache and gives developers full control over the configuration.

Share tech news, updates, or what's on your mind.

Sign up to Post

I use FOS Rest Bundle with FOS user ton create registration form. The registration does not work so i tried to verify if there's an issue with my database.I've tried doctrine schema update and i receive a strange error .
[Doctrine\DBAL\Exception\DriverException]
  An exception occurred while executing 'CREATE TABLE `buyer` (id INT AUTO_INCREMENT NOT NULL, buyer_type_id INT DEFAULT NULL, country_id
   INT DEFAULT NULL, language_id INT DEFAULT NULL, first_market_region_id INT DEFAULT NULL, second_market_region_id INT DEFAULT NULL, thi
  rd_market_region_id INT DEFAULT NULL, creator_user_id INT DEFAULT NULL, modifier_user_id INT DEFAULT NULL, `name` VARCHAR(320) NOT NULL
  , `description` VARCHAR(1024) DEFAULT NULL, `main_products_services` VARCHAR(512) DEFAULT NULL, `reference_number` VARCHAR(100) DEFAULT
   NULL, `phone` VARCHAR(20) DEFAULT NULL, `fax` VARCHAR(20) DEFAULT NULL, `website` VARCHAR(100) DEFAULT NULL, `email` VARCHAR(255) DEFA
  ULT NULL, `first_name` VARCHAR(100) DEFAULT NULL, `last_name` VARCHAR(100) DEFAULT NULL, `job` VARCHAR(255) DEFAULT NULL, `picture` VAR
  CHAR(255) DEFAULT NULL, `address` VARCHAR(500) DEFAULT NULL, `zip_code` VARCHAR(10) DEFAULT NULL, `city` VARCHAR(10) DEFAULT NULL, `com
  pany_name` VARCHAR(320) DEFAULT NULL, `total_revenu` VARCHAR(100) DEFAULT NULL, `first_market_rate` INT DEFAULT NULL, `second_market_ra
  te` INT DEFAULT NULL, `third_market_rate` INT DEFAULT NULL, `is_public` TINYINT(1) NOT NULL, `views` INT DEFAULT NULL, …
0
Upgrade your Question Security!
LVL 12
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

In symfony 4 i have a form to manage user details.

There is a one-to-many relationship between User class and SecurityGroup class.

In my form i would like to have all SecurityGroup listed with checkboxes.
I've managed to do it, but if i check a checkbox the group is not added to the user after the handle request. (In the request dump i see my 2 checked groups)

Form Field:
->add('SecurityGroups', EntityType::class, [
                'class'     => 'App\Entity\SecurityGroup',
                'choice_label' => 'displayname',
                'query_builder' => function (SecurityGroupRepository $repo) {
                    return $repo->createQueryBuilder('f')
                        ->where('f.id > :id')
                        ->setParameter('id', 1);
                },
                'label'     => 'Member Of?',
                'expanded'  => true,
                'multiple'  => true,
            ])

Open in new window


Controller
public function edit(Request $request, $id)
    {

        $user = new User();

        if ($id == -1) {
            $module_title = 'Create a new User';
        }
        else
        {
            $module_title = 'Edit User';
            $user = $this->getDoctrine()->getRepository("App:User")->find($id);
        }

        $form = $this->createForm("App\Form\UserType", $user);


        $form->handleRequest($request);

        $current_user = $this->getUser();
        dump($request);
        dump($form);

        if ($form->isSubmitted() && $form->isValid())
        {

            $user = $form->getData();
            dump($user);
            
            $em = $this->getDoctrine()->getManager();
            $em->persist($user);
            $em->flush();
            $this->redirectToRoute('admin_user');
        }



        return $this->render('user/edit.html.twig', ['edit_form' => $form->createView(), 'module_title' => $module_title]);
    }

Open in new window


Dumps
Request {#86 ▼
  +attributes: ParameterBag {#70 ▶}
  +request: ParameterBag {#69 ▼
    #parameters: array:1 [▼
      "user" => array:8 [▼
        "username" => "admin"
        "email" => "email@email.email"
        "password" => ""
        "isActive" => "1"
        "DisplayName" => "admin"
        "SecurityGroups" => array:2 [▼
          0 => "2"
          1 => "4"
        ]
        "save" => ""
        "_token" => "YaqXjd73ZhrX8p1eOiFWZi1JWivaCLKMGZbulTsiRgE"
      ]
    ]
  }

Open in new window

0
Hello,

First of all sorry for my bad english! :)
I would like to make a keyword suggester with elasticsearch and symfony3.
My users want to publish a post. When they type the title of the post, it launch an ajax call at the 'focusout' of the title field.
This ajax call analyse the text and split the string at withespace. Then it launch a elastic query for each substring.
Its working but its a lot of request for nothing...
I would like to make a full text search and elastic gave me the keywords he found in the text.
For exemple:
Title: I would ike to drive a bike in the city to go see the boat.
Elastic give : 'bike', 'city', and 'boat'

Experts Exchange make this autossuggest keyword with the title.

If someone can help me :)

Thank a lot,
best regards.
Quentin,
0
We need a website for offering jobs and recruitment just like this one https://www.bayt.com
there are different ways to do that. we can develop our own frame work for it or we can use open source for the backend and maybe tamplates for the front end.
I want you to analyse this project requirements .
Please help me to find the requirements for this project.
0

Symfony

9

Solutions

21

Contributors

Symfony is a PHP web application framework for MVC applications. Symfony provides an architecture, components and tools for developers to build complex web applications faster. Symfony is aimed at building robust applications in an enterprise context by speeding up the creation and maintenance of web applications and replacing repetitive coding tasks. It has a low performance overhead used with a bytecode cache and gives developers full control over the configuration.

Top Experts In
Symfony
<
Monthly
>

No Top Experts for this time period. Answer questions to earn the title!