symfony1

Using Raw SQL with Doctrine

放肆的年华 提交于 2019-12-17 10:22:41
问题 I have some extremely complex queries that I need to use to generate a report in my application. I'm using symfony as my framework and doctrine as my ORM. My question is this: What is the best way to pass in highly-complex sql queries directly to Doctrine without converting them to the Doctrine Query Language? I've been reading about the Raw_SQL extension but it appears that you still need to pass the query in sections (like from() ). Is there anything for just dumping in a bunch of raw sql

LESS CSS & Symfony - Updating color schemes dynamically

江枫思渺然 提交于 2019-12-14 02:43:49
问题 I'm working with the Symfony 1.4 and I'm running into a bit of a problem using the LESS CSS preprocessor. Let's say that I have 2 Less files with color specific variables. They are called blue.less and red.less . Here they are: Blue.less @mainBorder: blue; @pulldownBackground: blue; Red.less @mainBorder: red; @pulldownBackground: red; Now let's say that I have a layout.less file that will look something like this: // Colored line under Nav .main { border: 1px solid @mainBorder; .pullDown {

Auto-generate field value on sfGuardUser when registering

大憨熊 提交于 2019-12-14 02:26:39
问题 I'm building a Symfony 1.4 project that is using sfDoctrineGuardPlugin for users/authentication. I have a field on my user table named "access_token" that I would like to populate with an auto-generated value upon user registration. I see that for registration, the sfGuardRegisterForm is used for validation. Unfortunately, when I run ./symfony doctrine:build-forms from the command line, this form doesn't appear to be extended, meaning that I can't generate an access token there without

Url encode a dot (.) in URL?

北战南征 提交于 2019-12-14 01:15:39
问题 Currently I am doing a small code in symfony that will cause url have resource like this: http://url/val/abc.abxhd I was able to get the parameter abc successfully from http://url/val/abc , but when I try to run the URL of http://url/val/abc.abxhd . Symfony simply throw a 404 error. What could be the problem here. the URl are written using rawurlencode also. group: url: /group/:group param: {module: group, action: show} requirements: sf_method: [get] 回答1: Actually symfony was finding dot (.)

How do I include stylesheets with symfony properly?

元气小坏坏 提交于 2019-12-13 19:21:57
问题 I have a simple Template (layout.php) and I use Propel as ORM. When i include sylesheets (into of layout.php) with the function: include_stylesheets() I became 2 css: /sfPropelORMPlugin/css/global.css /sfPropelORMPlugin/css/default.css why? when I look into my view.yml actually I just have this: default: http_metas: content-type: text/html stylesheets: has_layout: true layout: layout I configure no stylesheets but I see Propel css in my Head Tag! my generator.yml : generator: class:

symfony doesn't like PostgreSQL with doctrine:build-schema

冷暖自知 提交于 2019-12-13 17:40:56
问题 I'm having a weird thing happen when I run doctrine:build-schema with my PostgreSQL database. It should just work, of course, but instead I'm getting this: jason@ve:~/salon$ ./symfony doctrine:build-schema >> doctrine generating yaml schema from database SQLSTATE[42P01]: Undefined table: 7 ERROR: missing FROM-clause entry for table "t" LINE 6: ... t.typtype ... ^. Failing Query: " SELECT ordinal_position as attnum, column_name as field, udt_name as type, data_type as complete_type, t.typtype

Can't use flash method in prod environment

空扰寡人 提交于 2019-12-13 16:19:13
问题 I'm using the setFlash and hasFlash methods of symfony 1.4 with WAMP 2.0 Locally with my frontend_dev app, all work fine. But in production environment, my test $this->forward404Unless($user->hasFlash('resultsArray')); fails. I thought that the flash methods where enabled by default. What can I do to make it works please ? Edit : I found an interesting error message. Here is my filters.yml file # You can find more information about this file on the symfony website: # http://www.symfony

How to deal with m2m relationship(posts and tags) by doctrine(in symfony)?

和自甴很熟 提交于 2019-12-13 09:50:00
问题 posts and tags have a many-to-many relationship(pretty much like stackoverflow),so the code to do it without an ORM should be: $dml = "insert into posts(title,body,created) value($title,'{$_POST['post-text']}',now())"; mysql_query($dml,$con); $pid = mysql_insert_id($con); //deal with tags if(isset($_POST['tagnames'])) { $tags = preg_split('/\s+/',trim($_POST['tagnames'])); $list = "('".implode("',1),('", $tags)."',1)"; $dml = "insert into tags(name,count) values $list on duplicate key update

dynamic subdomains in Symfony 1.4

不想你离开。 提交于 2019-12-13 09:13:49
问题 I am trying to create dynamic subdomains in .htaccess. I want something like this: http://ladygaga.koncert.com --> http://koncert.com/concerts/ladygaga 回答1: kris wallsmith published something in the symfony blog, about subdomain routing in sf1.2. maybe this helps you: http://symfony.com/blog/call-the-expert-adding-subdomain-requirements-to-routing-yml 来源: https://stackoverflow.com/questions/6678103/dynamic-subdomains-in-symfony-1-4

Doctrine 1.2: How do i prevent a contraint from being assigned to both sides of a One-to-many relation?

只愿长相守 提交于 2019-12-13 08:24:33
问题 Is there a way to prevent Doctrine from assigning a contraint on both sides of a one-to-one relationship? Ive tried moving the definition from one side to the other and using owning side but it still places a constraint on both tables. when I only want the parent table to have a constraint - ie. its possible for the parent to not have an associated child. For example iwant the following sql schema essentially: CREATE TABLE `parent_table` ( `child_id` varchar(50) NOT NULL, `id` integer