symfony1

How to make 'symfony doctrine:build-sql' task generate 'DROP' statments?

本秂侑毒 提交于 2020-01-06 03:39:28
问题 Is there a way to make symfony doctrine:build-sql task generate DROP statments before CREATE TABLE ones as it symfony propel :build-sql does ? ? 回答1: There is no such possibility, but you can run the doctrine:drop-db task before inserting the the SQL. A regular way with doctrine is: > symfony doctrine:build-sql > symfony doctrine:drop-db > symfony doctrine:insert-sql 来源: https://stackoverflow.com/questions/3626234/how-to-make-symfony-doctrinebuild-sql-task-generate-drop-statments

How to add a prefix to all my routes

落爺英雄遲暮 提交于 2020-01-05 07:52:49
问题 I'm currently working on a website built with symfony 1.4 and I need to implement a route prefix for all the routes. This prefix is used to specify two differents "views" for the website, for exemple : www.domain.com/b2b : B2B oriented view www.domain.com/b2c : B2C oriented view Both of these URLs render the same modules/actions but with little specific differences (textes, images, ...). So, www.domain.com/b2b/module1/action1 and www.domain.com/b2c/module1/action1 must proceed the same action

How to add a prefix to all my routes

…衆ロ難τιáo~ 提交于 2020-01-05 07:52:06
问题 I'm currently working on a website built with symfony 1.4 and I need to implement a route prefix for all the routes. This prefix is used to specify two differents "views" for the website, for exemple : www.domain.com/b2b : B2B oriented view www.domain.com/b2c : B2C oriented view Both of these URLs render the same modules/actions but with little specific differences (textes, images, ...). So, www.domain.com/b2b/module1/action1 and www.domain.com/b2c/module1/action1 must proceed the same action

Symfony - Add a column to a table without losing already generated classes

霸气de小男生 提交于 2020-01-05 07:30:03
问题 How can I add a column to a Database table without overwriting the classes already generated? (Doctrine) What files do I have to edit? If I simply add the column in the database, I can't use the set and get functions of Doctrine ORM. 回答1: Use doctrine migrations. It allows you to modify your schema, update the database and your model without also losing the existing data in your database (in case it is relevant). http://www.symfony-project.org/doctrine/1_2/en/07-Migrations Applicable for

Symfony - Add a column to a table without losing already generated classes

ⅰ亾dé卋堺 提交于 2020-01-05 07:29:02
问题 How can I add a column to a Database table without overwriting the classes already generated? (Doctrine) What files do I have to edit? If I simply add the column in the database, I can't use the set and get functions of Doctrine ORM. 回答1: Use doctrine migrations. It allows you to modify your schema, update the database and your model without also losing the existing data in your database (in case it is relevant). http://www.symfony-project.org/doctrine/1_2/en/07-Migrations Applicable for

Symfony: trying to retrieve a variable saved using sfContext::getInstance()

穿精又带淫゛_ 提交于 2020-01-05 07:08:13
问题 i have these methods in module1/actions/actions.class.php: public function executeMethod1(sfWebRequest $request){ $a = 10; sfContext::getInstance()->set('a', $a); return $this->redirect('module1/method2'); } public function executeMethod2(sfWebRequest $request){ echo sfContext::getInstance()->get('a'); } When i execute module1/method1 i get this error: "The "a" object does not exist in the current context." Any idea? Javi 回答1: The redirect is telling the browser to load another page which

Handling Multiple Config Files in symfony and non symfony

坚强是说给别人听的谎言 提交于 2020-01-05 03:37:33
问题 In my web application some of my application is in symfony and some is in non symfony. As a result there are multiple database connection files (say database connections files one of which is a yml file and other is a php file.) I am thinking to create a table and store database connection in this table and then create config files from them. Is there any other approach for this. 回答1: You should keep the databases.yml and load it from your non symfony application. Inside your non symfony

Handling Multiple Config Files in symfony and non symfony

帅比萌擦擦* 提交于 2020-01-05 03:37:26
问题 In my web application some of my application is in symfony and some is in non symfony. As a result there are multiple database connection files (say database connections files one of which is a yml file and other is a php file.) I am thinking to create a table and store database connection in this table and then create config files from them. Is there any other approach for this. 回答1: You should keep the databases.yml and load it from your non symfony application. Inside your non symfony

same session, different domains, set session id

时光总嘲笑我的痴心妄想 提交于 2020-01-03 20:00:08
问题 I have a couple of domains which i want to shere sessions. I have created a method like this: The user login is done in a central place and the sessions are saved in the database. Lets say the user A wants to go to abc.com domain. My app redirects it to the main authentication domain where he logs in. After login is generated an auth token which is saved in a field in the sessions table and it is pass back to the abc.com application. There I use the auth_token to get the session_id from the

SELECT DISTINCT YEAR Doctrine

血红的双手。 提交于 2020-01-03 06:36:53
问题 I want to select distinct year from mysql database using doctrine: it is easy to do this using mysql SELECT DISTINCT DATE_FORMAT( year , '%Y') as dates FROM Inscription i don't find how to do this in doctrine documentation, anyone can help? 回答1: The SQL statement SELECT DISTINCT DATE_FORMAT( year , '%Y') as dates FROM Inscription can be written in Doctrine as follows: A. If you are writing a table method: class InscriptionTable extends Doctrine_Table { /* ... */ public function