symfony-1.4

How to order by multiple columns with propel

大城市里の小女人 提交于 2019-12-10 20:32:43
问题 I need to sort a query by 2 columns. Is this possible using propel? i tried: $c->addAscendingOrderByColumn(self::COL1); $c->addAscendingOrderByColumn(self::COL2); but the second call to addAscendingOrderByColumn overrides the first one. Regards, Radu. 回答1: Unfortunately, if you are using Propel 1.4 (Symfony 1.4), it seems that you will have to switch to raw SQL there... No answer in the (old) Symfony forum : http://oldforum.symfony-project.org/index.php/m/90447/ However, since Propel 1.5 it

symfony 1.4 propel 1.6 : sum

自作多情 提交于 2019-12-10 15:44:19
问题 I'm trying to get a sum of columns in propel. My code $c = new Criteria(); $c->add(valuePeer::OWNER_ID, $this->getId()); $c->addSelectColumn('SUM(' . valuePeer::VALUE . ') as total'); $c->addGroupByColumn(valuePeer::VALUE); $sum = valuePeer::DoSelect($c); printing out $sum returns nothing (not even an empty object). all i get is Notice: Undefined offset: 1 in /.../lib/model/om/BaseValue.php on line 203 Notice: Undefined offset: 2 in /.../lib/model/om/BaseValue.php on line 204 I tried this

Bad search filter on LDAP when trying to get user data

蹲街弑〆低调 提交于 2019-12-10 13:00:46
问题 I am fresh out of the box here with LDAP, so let me know if I am doing this in the completely wrong fashion. I am working with Symfony 1.4 using the bhLDAPAuthPlugin plugin I am verifying user login with LDAP. However, there is more data in the LDAP table that I would like to query using the username. So I am writing this search function to filter results according to the username: function user_values($username) { if (!$username) { die ("Username is not there man!"); } if (!$this->_conn) {

Preventing Doctrine's query cache in Symfony

对着背影说爱祢 提交于 2019-12-10 12:50:57
问题 In my Symfony/Doctrine app, I have a query that orders by RANDOM(). I call this same method several times, but it looks like the query's result is being cached. Here's my relevant code: $query = $table->createQuery('p') ->select('p.*, RANDOM() as rnd') ->orderBy('rnd') ->limit(1) ->useQueryCache(null) ->useResultCache(null); $result = $query->fetchOne(); Unfortunately, the same record is returned every time, regardless of me passing null to both useQueryCache and useResultCache . I tried

Session deletion in Symfony 1.4

醉酒当歌 提交于 2019-12-09 06:52:35
问题 How do I delete all session variables at once if they are not in Array? PS I set them this way: $this->getUser()->setAttribute('PayPalTransaction.hash', $request->getParameter('hash')); Regards, Roman 回答1: The sfUser class (which you get with $this->getUser() ), keeps all it's attributes in a sfNamespacedParameterHolder . So the setAttribute() function on sfUser if merely a proxy to the sfNamespacedParameterHolder::setAttribute() . You can get the reference to this holder with sfUser:

Backend sfGuardUser module

爷,独闯天下 提交于 2019-12-08 11:22:45
问题 I use symfony 1.4.11 with Doctrine I have sfGuardUser module in backend. I have sfGuardUserProfile table. sfGuardUserProfile: connection: doctrine tableName: sf_guard_user_profile columns: id: { type: integer(4), primary: true, autoincrement: true } user_id: { type: integer(4), notnull: true } salutation: { type: string(10), notnull: true } first_name: { type: string(30), notnull: true } last_name: { type: string(30), notnull: true } country: { type: string(255), notnull: true } postcode: {

symfony - sfDoctrineGuard - restricting user creation based on group credentials

天涯浪子 提交于 2019-12-08 10:34:18
问题 I am currently in the process of developing a fairly large and complex user management system using sfDoctrineGuard I have created 4 groups, editors , moderators , admins and superadmins . What I'm looking to do, is restrict certain users in the admin to be able to create/view/edit other users in the sfGuardUser admin module. So for example a superadmins user can create editors , moderators , admins and other superadmins , but a moderator can only create editors . Is this possible in

How to convert a value before saving the form?

无人久伴 提交于 2019-12-08 10:10:17
问题 I want to convert a value before saving the form. I don't know where to add the code because the only method is form->save() Could you please help me ? Edit: if ($this->form->isValid()) { $url = $this->form->getObject()->getLink(); parse_str(parse_url($url, PHP_URL_QUERY), $my_array_of_vars); $this->form->getObject()->setLink($my_array_of_vars['v']); $song = $this->form->save(); $this->getUser()->setFlash('notice', 'Thank you, the song has been added'); $this->redirect('@homepage'); } 回答1:

symfony i18n objects (Doctrine) get specific culture

寵の児 提交于 2019-12-08 09:25:37
问题 I am having an issue where I cannot retrieve a specific translation from my i18n doctrine objects. If I call $object->getName(); I get the name in the current culture as expected. However, if I wish to retrieve a specific translation without switching the user culture... $object->getName('fr'); I still get the current culture instead of French in this example. This $object->getTranslation()->fr->name; does work though. What am I doing wrong? Isn't $object->getName($culture); the correct way

How to restrict user to be logged only one time per session?

一笑奈何 提交于 2019-12-08 09:09:26
问题 I'm working a Symfony 1.4 apps, and I need to prevent a user beeing able to login more than once into the application, I mean if S/He is already logged in, it should not be able to logged in just opening a new browser. user log in on Chrome. Open Firefox, try to login and then can't login because a session is already active on Chrome I want to avoid same user begins another session with a different browser in the same computer, or in another. 回答1: The only solution I think about is to use