symfony1

Using multiple php frameworks on one website

巧了我就是萌 提交于 2019-11-28 14:05:46
Our main website uses symfony 1, and by the time I started working on the code it seems impossible to upgrade (too much custom code from previous developer). Now we are adding a large addition to what the company offers. Instead of using a really old framework I wanted to use CodeIgniter, also since I'm very familiar with it. My real question: What is a proper way of setting up a website to use multiple frameworks. The new features will be separate from the original website, but it will still need a few tables of the database. I was going to have apache handle where the root directory was

symfony redirect with 2 parameters

假装没事ソ 提交于 2019-11-28 05:19:21
how can i redirect to another action passing 2 or more parameters? this code: $this->redirect('input/new?year=' . $year . '&month=' . $month); results in URL: http://.../input?year=2009&month=9 Well, that's normal, "redirect" redirect to an absolute URL. You can do that: $this->redirect($this->generateUrl('default', array('module' => 'input', 'action' => 'new', 'year' => $year, 'month' => $month))); In currently supported Symfony versions (2.7+) it's even easier : return $this->redirectToRoute('default', array('year' => $year, 'month' => $month)); You can also use redirect, specifying the

Force HTTPS using only HTACCESS in SYMFONY

佐手、 提交于 2019-11-28 01:44:54
问题 We have a Symfony 1.4 project and are looking to force https for all pages in a symfony application using only the htaccess file. I know there are ways to do using filters but I want to know if its possible to do without that first? Here is the .HTACCESS file I currently am using but isn't working as expected... RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L] RewriteCond %{REQUEST_FILENAME} !-f I've also tried without success: RewriteCond %

MySQL User defined variable within Doctrine and Symfony

懵懂的女人 提交于 2019-11-28 01:23:28
问题 I have the following Doctrine statement which works fine. $query = $this->createQuery('r') ->select('u.id, CONCAT(u.first_name, " ", LEFT(u.last_name,1)) as full_name, u.first_name, u.last_name, u.gender, r.run_time') ->innerJoin('r.ChallengeUser u') ->orderBy('run_time') ->execute(array(), Doctrine::HYDRATE_ARRAY_SHALLOW); I need to add a row count into this. Now I know with raw SQL you can do this; SET @rank=0; SELECT @rank:=@rank+1 as rank, u.id, u.first_name ....etc So my question is, how

Multiple databases support in Symfony

倖福魔咒の 提交于 2019-11-27 18:56:36
问题 I am using Propel as my DAL for my Symfony project. I can't seem to get my application to work across two or more databases. Here's my schema.yml: db1: lkp_User: pk_User: { type: integer, required: true, primaryKey: true, autoIncrement: true } UserName: { type: varchar(45), required: true } Password: longvarchar _uniques: Unique: [ UserName ] db2: tesco: Id: { type: integer, required: true, primaryKey: true, autoIncrement: true } Name: { type: varchar(45), required: true } Description:

symfony admin filter with join

≯℡__Kan透↙ 提交于 2019-11-27 16:55:05
问题 I have a table, heading , that has an import_profile_id . import_profile has a bank_id . On my headings list page in my admin, I'd like to add the ability to filter by bank_id . However, since heading doesn't have a bank_id - it needs to go through import_profile to get that - I can't just add a bank_id field and expect it to work. Can anyone explain how to do this? The closest thing I've found is this post but I don't think it really addresses my issue. 回答1: This can be done by using virtual

zend-framework versus Kohana versus Symfony [closed]

拥有回忆 提交于 2019-11-27 14:03:43
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed last year . Which one of this frameworks would you recommend to someone who knows the basics of PHP? What are the advantages and disadvantages? 回答1: I wouldn't suggest any frameworks to someone who knows just the basics. Instead, I'd suggest to get a firm grip on OOP and the most common

What is the safest way of passing arguments from server-side PHP to client-side JavaScript [duplicate]

♀尐吖头ヾ 提交于 2019-11-27 13:55:41
This question already has an answer here: How do I pass variables and data from PHP to JavaScript? 19 answers In my application I rely heavily on JavaScript to enhance the user interface, but all of the data comes from a database and is processed by PHP. By default I use 'echo' statements to substitute the required values "just in time" like so: var myVariable = <?php echo $myVariableInPHP ?> This, however, does not strike me as very elegant and I am concerned about stability and maintainability of such code. Do I have any alternatives here? For server-side, I am using the Symfony 1.4 PHP

How to use Sessions in Symfony? [closed]

微笑、不失礼 提交于 2019-11-27 13:29:50
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . Like in classic PHP we use the magic variables to start and create sessions, so how to do that in Symfony? 回答1: In your controller, you can access session variables through the user object. // Get a session value

Symfony FOSUserBundle - include login form in layout template

本秂侑毒 提交于 2019-11-27 12:45:53
问题 We've successfully configured the FOSUserBundle; login, register, reset password, etc, are all working just fine. Now we want to incorporate the login form into our general site layout, notably placing the form into the top-right section of the layout header. Doing this would be easy enough if we were just dealing with the username and password fields. However we can't seem to figure out how to obtain the CSRF token which is generated by the FOSUserBundle service: $this->container->get('form