Symfony

18

Solutions

31

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

https://symfony.com/doc/2.8/controller/service.html

Do I just follow that and there's no adverse affect on what is already using that controller?
0
PMI ACP® Project Management
LVL 13
PMI ACP® Project Management

Prepare for the PMI Agile Certified Practitioner (PMI-ACP)® exam, which formally recognizes your knowledge of agile principles and your skill with agile techniques.

Our LAMP stack website was failing to make connection to an azure database, very sporadically but very often, like every 3rd click that you'd hit where it needed to go out to azure for data. The exact errors in the Symfony prod.log was:

Connection Failed:[unixODBC][Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: Error code 0x274C

and

app.ERROR:  error : [unixODBC][Microsoft][ODBC Driver 13 for SQL Server]TCP Provider: Error code 0x68

We tired everything, our web host made sure our ODBC driver was the same on the production server (which had the issue) as it was on our staging server (exact same code base and it did not ever have the issue)... it is exactly the same. All Azure logs and settings looked fine. The production server disk space and RAM have plenty of room.

I finally out of desperation trashed the cache of Symfony on our production server. Since then, actually a bit before then, we haven't had the issue.

What could the issue have been? I need to know what it was to prevent it in the future.
0
We use Symfony 2.8 as the framework for our website. The people who set it up years ago probably didn't do it right, and we have about 10 different bundles which comprise all the different areas of our site (Cart, MyAccount, Products, Pages, etc).

Two questions:

Should the entire website be under just one bundle, so we dont have duplicated code in multiple bundles?

and

If a bundle needs a bit of code to get a piece of data, should that be written as a service so we can call it from anywhere, without having multiple lines of code duplicated all over the place wherever we need that piece of data?
0
I am trying to install partkeepr.org on a Ubuntu 16.04LTS machine

- It is running LEMP with nginx

When the install starts, it prompts that Symfony is not installed.

Symfony error message https://prnt.sc/mqmr0o

I have installed Symfony and it's still not working.

Anyone ever used Symfony and can give this Linux neophite a few tips to make it work?
0
I'm working in Symfony and attempting to implement a JQuery post dynamic.

I found an example that's currently working in the existing code, but I'm new enough to Symfony where it took me a while to figure out the routing configuration and even though I've been able to trace the logic, I'm still scratching my head.

Here's the first part of the JQuery code:

$.post('/admin/sites/' + psID + '/pages/' + ppID  + '/update', form, function(res){

Here's the routing located on the "routing_admin.yml" file:

admin_page_update:
    path: /sites/{psID}/pages/{ppID}/update
    defaults: { _controller: AppBundle:Page:update }

Mystery solved!

But, here are my questions:

How does Symfony keep track of all the various routing pages. In the tutorial that I've taken, there was only one routing file in the config file. How does Symfony keep all of these organized?

In the path above, "admin" is not referenced despite the fact that it is referenced in the JQuery code. How does Symfony know to process...

$.post('/admin/sites/' + psID + '/pages/' + ppID  + '/update', form, function(res)

as...

admin_page_update:
    path: /sites/{psID}/pages/{ppID}/update
    defaults: { _controller: AppBundle:Page:update }

...when "admin" is not referenced in the path? I'm thinking "path" should look like this:

admin_page_update:
    path: /admin\/sites/{psID}/pages/{ppID}/update
    defaults: { _controller: AppBundle:Page:update }

Thanks!
0
I need to alter the PHP below to make is so if $rep_info is empty when user logs in, they are directed back to where they came from instead of /account/home. I have it kind of cobbled together in but I get a parse error, and therefore haven't tested it (Im taking over for somebody elses code, still learning).

The goal is to make it so if somebody logs in to their website account, and they are a rep, it should not take them to account/home. It should leave them right where they are / came from. All of this works, it's just the part where Im trying to add the rep detection part that I'm altering here.

Area of code that i have error:

	} 
	
	if(empty($path) || (empty($rep_info)) {
	   $path = $session['location'];
	}
        
        }
             
	if($path == "/") {
	   $path = "/account/home";	
	}

Open in new window



Full code:

<?php
namespace MySite\MyAccountBundle\Services;

use Symfony\Component\Security\Http\Authentication\AuthenticationSuccessHandlerInterface;

use Symfony\Component\Security\Core\Authentication\Token\TokenInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Cookie;
use MySite\MyAccountBundle\Services\CartHandler;

use MySite\WebSite\DbAccessor;
use MySite\WebSite\DbAzure;

class LoginSuccessHandler implements AuthenticationSuccessHandlerInterface
{

    public function onAuthenticationSuccess(Request $request, TokenInterface $token) {
       

Open in new window

0
Total noob here, trying to ramp up knowledge to replace somebody at work who's leaving... In a Symfony 2 controller I am trying to add a public function (a SQL query) from the DB.php file. It will output to a JSON response. The IDE shows an error, which I'm sure is because I don't have all the needed info in there. What else do I need? Please see attached pic.
2018-08-11_15-04-11.jpg
0
I have ReturnRequestController.php, which allows a customer to return a product on an order. I pass the variables order_number and sku to the controller via an API call (URL with values embedded in it). As long as the values passed aren't 0, then I return a JSON response saying success. All of that works fine.

btw, the API URL looks like this:

https://dev.mysite.com/account/return_request/?order_number=27652&qm_sku=24&options=chartreuse&qty=3&email=billy@gibbons.com

Open in new window


What I need... I need to make sure the order number and the sku actually belong together (the sku is on the order) and the order belongs to the customer ID who submitted the request (I do have the customer ID available to me already in the ReturnRequestController.php).

There is a public function called GetCustomerOrder outside of ReturnRequestController.php, in a file called DbAzure.php. That function is shown below, and the function in ReturnRequestController.php is shown below that. Is there a way to use function GetCustomerOrder from DbAzure.php inside another function (index) in a different file (ReturnRequestController.php) which will check to make sure the order number coming in via the API URL is an order that customer placed, AND that the sku in the API URL is on that order?

In DbAzure.php:
    public function getCustomerOrder($om_customer_id, $order_number) {
       $query = "SELECT o.OrderNumber,
                        o.SourceOrderNumber,
                        

Open in new window

0
I am gearing up to a new role here at work... I've been the main IT guy for 17 years, and in the first few of those years I did quite a bit of PHP coding for our website. Since that time, we've grown a lot and have had a full time backend web developer (leaving the company in October) who is a wizard with PHP, MySql, Symfony. Those are the core MVC languages we use in the backend... our front end person uses Twig, React, etc but I won't have to do much with that except pass her data she can display whoever she wants.

Where are a couple good courses I can take to get up to speed with PHP these days? From working with our existing backend guy, he's walking me through Symfony a lot but I've notice he is hand-coding a ton of PHP / MySQL stuff and I realized that is where I need to concentrate learning right now. Any good resources out there, or is Udemy the end all be all. If so, which Udemy course most applies to my needs. Thanks much for any input.
2
Symfony Doctrine:

When I create the following database column I want the name in the DB to be "statusID" but it gets written as "status_id"

How can I change this?

    /**
     * @ORM\Column(type="integer", nullable=true)
     */
    protected $statusID;
    public function getStatusID()
    {
          return $this->statusID;
    }
    public function setStatusID($statusID)
    {
          $this->statusID = $statusID;
          return $this;
    }
0
Exploring SharePoint 2016
LVL 13
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

I need some consultation about development own ERP system.
We use PHP7 Symfony framework.
I want to design solution as microservices architecture. use some service as core and several services for connecting to core and obtain data.
core service connect to database via ORM. Which database can we use fro this solution.
can we use shared table database for multitenant architecture.

I need your advice for this solution.
0
Going through a tutorial on PHP Symfony and at one point it suggests setting up a git repository. Here's my CLI sequence...

screenshot
This is supposed to be cake and ice cream. Navigate to the home directory, enter "git init" and then, BOOM.

Instead I get an error that says "the git command is not recognized..."

What am I missing?
0
I'm going through a tutorial in Symfony and despite the fact that I'm still in the shallow end of the pool, I can't get the very first page in the tutorial to come up and I don't know why.

Let me also mention this: According to the tutorial, I should get a default page when I use this URL: localhost/aqua_note. An error came up when I went to that URL. When I went to this URL: localhost/aqua_note/web, I got the default page they reference in the course.

I removed the DefaultController and replaced it with the code they present which looks like this:

<?php

namespace AppBundle\Controller; //namespace must match the Directory Structure

use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Component\HttpFoundation\Response;

class DefaultController
{
	/**
	*@Route("/genus")
	*/
	public function showAction() //the only rule for a controller function is that it must return a Symfony response object
	{
		return new Response('Under the Sea!');
	}
}


?>

Open in new window


When I go to the page which should show up now as localhost/aqua_note/genus, I get a 500 error.

Why? What am I doing wrong?

Let me also say that I ran into some trouble using the Symfony installer and instead used Composer. If that makes a difference, I'm not sure, but any direction at this point would be very much appreciated.

Thanks!
0
I've downloaded the installer, moved it to the wamp64 directory.

I'm running the Command Prompt as an Administrator, but when I go to do the command, "symfony new project" I get an error that says, "'symfony' is not recognized as an internal or external command,
operable program or batch file."

What am I doing wrong?

Here's a screenshot:

screenshot
Thanks!
0
- We are currently using Symfony2 for our developments.
- We plan a major redesign of our main application.
- I'm afraid that Symfony performance (speed, memory) is really bad
- So I'm exploring other PHP-Frameworks that might improve the situation.

Question: Which php framework are you using? would you recommend?

My homework: some of the links I have explored without feeling completely informed...
- https://www.experts-exchange.com/questions/28933008/PHP-Frameworks.html here seem to very warmly recommend Laravel
- http://www.sitepoint.com/best-php-framework-2015-sitepoint-survey-results/ gives the result of a survey among their readers (I must confess I'm slightly sceptic when looking at ZF popularity, that I would believe really higher in "real world")
- https://www.techempower.com/benchmarks/#section=data-r12&hw=peak&test=json&b=1&s=2&l=sg&p=w-4fti4g-0&d=1y&a=1 (and other tabs) give some performance data about multiple usage scenarios, in which phalcon shines as compared to well established frameworks like Laravel, Symfony or Zend Framework.


Getting performance around 10-20 times better for Phalcon than for Symfony, Laravel or ZF really puzzles me: I can compensate a X2 or x4 handicap by spending more money on my servers rents, but I'm afraid x10 or x20 simply does not make an economic sense.

You comments, suggestions and warning will really be useful!
1
in a framework like Symfony, should we throw exceptions from managers / models or Controllers?

Right now I am throwing it from both, just wanted to know what's the practice is?
0
Hi,

Symfony is creating new session ID on every AJAX request. Because of this sessions are getting maintained. How can I fix this?
0
Hi,

I have three domains:

1. Domain A [Symfony 2.7 API Endpoints only]
2. Domain B [Angular APP]
3. OpenId provider

If user logs in into Domain A via Open Id, how can I set the session in Domain B. Right Now when I am trying to set the session via Angular APP, it just stays for very same request, as soon as I refresh the page Session expires.

I have this in my config.yml

    session:
        # handler_id set to null will use default session handler from php.ini
            name: nandan_sess
            cookie_httponly:  false
            cookie_lifetime:  86400
0

Symfony

18

Solutions

31

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!