Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Trying to fetch a column
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  11 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
tirengarfio  
View profile  
 More options Nov 16 2009, 12:09 pm
From: tirengarfio <tirengar...@gmail.com>
Date: Mon, 16 Nov 2009 09:09:53 -0800 (PST)
Local: Mon, Nov 16 2009 12:09 pm
Subject: Trying to fetch a column
Hi,

i have a table to with two fields: user1 and user2.

I have also this code to fetch the user2 column:

// Extraemos los amigos del usuario de la sesion.
    $this->lista_amigos = Doctrine::getTable('FriendReference')
      ->createQuery('a')
      ->select('a.user2')
      ->where("a.user1 LIKE ?", $this->getUser()->getGuardUser()->getId
())
      ->execute();

My problem: that code not only fecths the user2 column but also the
user1 column..

What am i doing wrong??

Bye

Javi


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
gunzip  
View profile  
 More options Nov 16 2009, 1:31 pm
From: gunzip <spammm...@gmail.com>
Date: Mon, 16 Nov 2009 10:31:49 -0800 (PST)
Local: Mon, Nov 16 2009 1:31 pm
Subject: Re: Trying to fetch a column
How do you cycle within the resultset ?
Doctrine has lazy loading so if you do $myresult['user1'] it will make
__another__ query to fetch the column.

On 16 Nov, 18:09, tirengarfio <tirengar...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tirengarfio  
View profile  
 More options Nov 16 2009, 2:08 pm
From: tirengarfio <tirengar...@gmail.com>
Date: Mon, 16 Nov 2009 11:08:39 -0800 (PST)
Local: Mon, Nov 16 2009 2:08 pm
Subject: Re: Trying to fetch a column
Thanks gunzip, this is my controller and view code:

  // Controller code

    $this->friends_list = Doctrine::getTable('FriendReference')
      ->createQuery('a')
      ->select('a.user2')
      ->where("a.user1 LIKE ?", $this->getUser()->getGuardUser()->getId
())
      ->execute();

    $this->friends = $this->friends_list->toArray();

  // View code

    $a = (int)in_array($member->getId(), $friends);

    echo $a;

    if ($a)
   {
      echo "Is your friend";
   }

    else
   {
      echo "Is not your friend";
    }

Javi

On Nov 16, 1:31 pm, gunzip <spammm...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tirengarfio  
View profile  
 More options Nov 16 2009, 2:08 pm
From: tirengarfio <tirengar...@gmail.com>
Date: Mon, 16 Nov 2009 11:08:47 -0800 (PST)
Local: Mon, Nov 16 2009 2:08 pm
Subject: Re: Trying to fetch a column
Thanks gunzip, this is my controller and view code:

  // Controller code

    $this->friends_list = Doctrine::getTable('FriendReference')
      ->createQuery('a')
      ->select('a.user2')
      ->where("a.user1 LIKE ?", $this->getUser()->getGuardUser()->getId
())
      ->execute();

    $this->friends = $this->friends_list->toArray();

  // View code

    $a = (int)in_array($member->getId(), $friends);

    echo $a;

    if ($a)
   {
      echo "Is your friend";
   }

    else
   {
      echo "Is not your friend";
    }

Javi

On Nov 16, 1:31 pm, gunzip <spammm...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tirengarfio  
View profile  
 More options Nov 16 2009, 2:13 pm
From: tirengarfio <tirengar...@gmail.com>
Date: Mon, 16 Nov 2009 11:13:45 -0800 (PST)
Local: Mon, Nov 16 2009 2:13 pm
Subject: Re: Trying to fetch a column
Thanks gunzip, this is my controller and view code:

  // Controller code

    $this->friends_list = Doctrine::getTable('FriendReference')
      ->createQuery('a')
      ->select('a.user2')
      ->where("a.user1 LIKE ?", $this->getUser()->getGuardUser()->getId
())
      ->execute();

    $this->friends = $this->friends_list->toArray();

  // View code

    $a = (int)in_array($member->getId(), $friends);

    echo $a;

    if ($a)
   {
      echo "Is your friend";
   }

    else
   {
      echo "Is not your friend";
    }

Javi

On Nov 16, 1:31 pm, gunzip <spammm...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tirengarfio  
View profile  
 More options Nov 16 2009, 2:13 pm
From: tirengarfio <tirengar...@gmail.com>
Date: Mon, 16 Nov 2009 11:13:57 -0800 (PST)
Local: Mon, Nov 16 2009 2:13 pm
Subject: Re: Trying to fetch a column
Thanks gunzip, this is my controller and view code:

  // Controller code

    $this->friends_list = Doctrine::getTable('FriendReference')
      ->createQuery('a')
      ->select('a.user2')
      ->where("a.user1 LIKE ?", $this->getUser()->getGuardUser()->getId
())
      ->execute();

    $this->friends = $this->friends_list->toArray();

  // View code

    $a = (int)in_array($member->getId(), $friends);

    echo $a;

    if ($a)
   {
      echo "Is your friend";
   }

    else
   {
      echo "Is not your friend";
    }

Javi

On Nov 16, 1:31 pm, gunzip <spammm...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tirengarfio  
View profile  
 More options Nov 16 2009, 2:17 pm
From: tirengarfio <tirengar...@gmail.com>
Date: Mon, 16 Nov 2009 11:17:07 -0800 (PST)
Local: Mon, Nov 16 2009 2:17 pm
Subject: Re: Trying to fetch a column
Thanks gunzip, this is my controller and view code:

  // Controller code

    $this->friends_list = Doctrine::getTable('FriendReference')
      ->createQuery('a')
      ->select('a.user2')
      ->where("a.user1 LIKE ?", $this->getUser()->getGuardUser()->getId
())
      ->execute();

    $this->friends = $this->friends_list->toArray();

  // View code

    $a = (int)in_array($member->getId(), $friends);

    echo $a;

    if ($a)
   {
      echo "Is your friend";
   }

    else
   {
      echo "Is not your friend";
    }

Javi

On Nov 16, 1:31 pm, gunzip <spammm...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tirengarfio  
View profile  
 More options Nov 16 2009, 2:20 pm
From: tirengarfio <tirengar...@gmail.com>
Date: Mon, 16 Nov 2009 11:20:03 -0800 (PST)
Local: Mon, Nov 16 2009 2:20 pm
Subject: Re: Trying to fetch a column
Thanks gunzip, this is my controller and view code:

  // Controller code

    $this->friends_list = Doctrine::getTable('FriendReference')
      ->createQuery('a')
      ->select('a.user2')
      ->where("a.user1 LIKE ?", $this->getUser()->getGuardUser()->getId
())
      ->execute();

    $this->friends = $this->friends_list->toArray();

  // View code

    $a = (int)in_array($member->getId(), $friends);

    echo $a;

    if ($a)
   {
      echo "Is your friend";
   }

    else
   {
      echo "Is not your friend";
    }

Javi

On Nov 16, 1:31 pm, gunzip <spammm...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tirengarfio  
View profile  
 More options Nov 16 2009, 2:20 pm
From: tirengarfio <tirengar...@gmail.com>
Date: Mon, 16 Nov 2009 11:20:35 -0800 (PST)
Local: Mon, Nov 16 2009 2:20 pm
Subject: Re: Trying to fetch a column
Thanks gunzip, this is my controller and view code:

  // Controller code

    $this->friends_list = Doctrine::getTable('FriendReference')
      ->createQuery('a')
      ->select('a.user2')
      ->where("a.user1 LIKE ?", $this->getUser()->getGuardUser()->getId
())
      ->execute();

    $this->friends = $this->friends_list->toArray();

  // View code

    $a = (int)in_array($member->getId(), $friends);

    echo $a;

    if ($a)
   {
      echo "Is your friend";
   }

    else
   {
      echo "Is not your friend";
    }

Javi

On Nov 16, 1:31 pm, gunzip <spammm...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Andrés Lartigue Debián  
View profile  
 More options Nov 16 2009, 3:30 pm
From: Andrés Lartigue Debián <alarti...@binova-it.fr>
Date: Mon, 16 Nov 2009 20:30:58 -0000
Local: Mon, Nov 16 2009 3:30 pm
Subject: RE: [doctrine-user] Re: Trying to fetch a column
Hi,

Try using $q = Doctrine_Query::create() instead of
Doctrine::getTable('FriendReference') ->createQuery('a')

Should be something like:

$this->lista_amigos = Doctrine_Query::create()
       ->createQuery('a')
       ->select('a.user2')
         ->from('FriendReference a')
       ->where("a.user1 LIKE ?", $this->getUser()->getGuardUser()->getId())
       ->execute();

Andrés Lartigue Debián
Binova Services Informatiques
www.binova-it.fr
+33 (0)3.44.37.08.85
P Pensez ŕ l’environnement, évitez si possible d’imprimer cet e-mail

-----Mensaje original-----
De: gunzip [mailto:spammm...@gmail.com]
Enviado el: Lunes, 16 de Noviembre de 2009 06:32 p.m.
Para: doctrine-user
Asunto: [doctrine-user] Re: Trying to fetch a column

How do you cycle within the resultset ?
Doctrine has lazy loading so if you do $myresult['user1'] it will make
__another__ query to fetch the column.

On 16 Nov, 18:09, tirengarfio <tirengar...@gmail.com> wrote:

--

You received this message because you are subscribed to the Google Groups
"doctrine-user" group.
To post to this group, send email to doctrine-user@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/doctrine-user?hl=.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
tirengarfio  
View profile  
 More options Nov 16 2009, 2:35 pm
From: tirengarfio <tirengar...@gmail.com>
Date: Mon, 16 Nov 2009 11:35:52 -0800 (PST)
Local: Mon, Nov 16 2009 2:35 pm
Subject: Re: Trying to fetch a column
Hi Andrés,

i think you mean this:

$this->lista_amigos = Doctrine_Query::create()
       ->select('a.user2')
         ->from('FriendReference a')
       ->where("a.user1 LIKE ?", $this->getUser()->getGuardUser()-

>getId())

       ->execute();

but the result is the same as using my attempt..

On Nov 16, 3:30 pm, Andrés Lartigue Debián <alarti...@binova-it.fr>
wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »