symfony1

How to get the object with its translation using getRoute in Symfony?

天涯浪子 提交于 2019-12-12 05:27:12
问题 I have several models with translations. When I load $this->tour = $this->getRoute()->getObject(); por example, it gets me the Tour Object. However, it doesn't join to the tour_translation table; so when after i try to get it's title; symfony makes another sql query. How I can override something, so in the Tour model when I ask for the object, it returns me the object with its translation in the current culture. I've been looking at the sfObjectRoute class to see if I can override any method,

In Symfony 1.2 how can I get the current database name from the database.yml file in Propel?

我只是一个虾纸丫 提交于 2019-12-12 04:34:57
问题 I have a raw sql query I need to run, but the database name changes in each environment (live: db, dev db_test) I need to get the current database name from the databases.yml file. How can I get just the current database name? I am using the Propel ORM 回答1: Initially I thought this would be pretty easy via sfPropelDatabase::getConfiguration() but that returns an array. As such, I had to parse the result to get the data, and I think there's probably a better way than this: $propel_config =

How can you/Is it feasible to override Doctrine_Connection in Symfony?

徘徊边缘 提交于 2019-12-12 04:33:49
问题 The university servers I'm currently working on lack PDO drivers, hence I've had to re-implement PDO & it's respective MySQL class to allow doctrine to connect to a MySQL database. This is all well and good (or as well as a PHP implementation of PDO can go) and obviously if uni didn't have PDO at all this would all just work. However, since they have PDO but no drivers , this means I can't re-instantiate PDO and have therefore called it _PDO. This change means that Doctrine_Connection has to

Performance impact of not closing propel connection

陌路散爱 提交于 2019-12-12 04:20:22
问题 I'm using symfony 1.4/propel 1.4 for a project, which was made by other developer earlier. On that project, propel connection is taken by using following code $con = Propel::getConnection(UsersPeer::DATABASE_NAME, Propel::CONNECTION_WRITE); However it never closes the connection using Propel::close(); I just searched that there are 1500+ such incidents of opening connection & I guess none of them is closing connection. I know its always good practice to close connection but in present case,

Symfony submit to same url

倖福魔咒の 提交于 2019-12-12 04:17:11
问题 I have a form with some text fields and I have a preview button that needs to submit the form to the same controller. And then in the controller, I need to extract the values and populate a form with these values for the template to see. What is the best way to achieve this? I'm a newbe so please be clear. 回答1: Sample controller: public function myControllerName(sfWebRequest $request) { $this->form = new myFormClass(); } Use <?php echo $form->renderFormTag( url_for('@yourRoutingName'), array(

Retrieving doctrine data from sfDoctrinePager object !

孤人 提交于 2019-12-12 03:49:50
问题 I am facing some issues while retrieving data from a doctrine pager object! Let me describe it below: This is my pager query: $pager = new sfDoctrinePager('sfGuardUser', '5'); $q = Doctrine_Query::create() ->select('u.id, u.username, p.org_name, g.name, l.status') ->from('sfGuardUser u') ->leftJoin('u.Profile p') ->leftJoin('u.Groups g') ->leftJoin('u.LicensedVendors l') ->where('g.name = \'client\''); $pager->setQuery($q); $pager->setPage($request->getParameter('page', 1)); $pager->init();

Validation form in Symfony 1.4

匆匆过客 提交于 2019-12-12 02:59:45
问题 I create a search form in my project but the validation seems not to be working : Filtersearchform : class FilterSearchForm extends sfForm { public function configure() { $def_volume = array(-1=>"Please select a volume"); $def_issue = array(-1=>"Please select issue"); $volumes = array_merge($def_volume,IssuePeer::getAllVolumesForListChoices()); $issues = array_merge($def_issue,IssuePeer::getAllIssuesForListChoices()); //******************************** WIDGET *********************************

symfony image inside a button?

旧时模样 提交于 2019-12-12 02:47:41
问题 I'm trying to include an image inside a button using symfony1.4 with this code: <?php echo button_to(image_tag('icon.png')."button_name",'url-goes-here'); ?> But the result i get, instead of what i want is a button with "img src=path/to/the/icon.png button_name" as the value of the button. I've google'd it long enought and found nothing, so i'll try asking here. In other words: i'd like to find the way to generate html similar to: <button><img src=..>Text</button> but with a symfony url

show html tags in template - symfony and CKEDITOR. how safety?

﹥>﹥吖頭↗ 提交于 2019-12-12 02:05:43
问题 i use Symfony 1.4 and Doctrine 1.2. I installed plugin http://www.symfony-project.org/plugins/sfCkPlugin if i add net data from form this working ok, but in template this show me for example: <p><b>bold</b> <i>test</i></p> etc instead of bold test I must something add here: getDesc() ?> , but what? In database MySQL i have: <p> <strong>bold</strong> <u>test</u></p> this is safety? 回答1: This is happening because of the output escaper in symfony. You can fix it by calling getRawValue() on the

Is there a way of using PHP-ActiveRecord as symfony's ORM/abstraction layer?

岁酱吖の 提交于 2019-12-12 01:58:24
问题 I just discovered PHP-ActiveRecord not too long ago after struggling for nearly a month to write my own ORM (I'm hard headed like that) and I fell in love with it. I had looked at Doctrine and Propel before but decided to run away due to the sheer complexity and learning curve. With AR, I don't have the anxiety and learning difficulty I had with the others. Shortly thereafter, I also discovered the symfony framework (I was also trying to make my own framework from stratch after finding other