[dev] Category::getCategoriesByAttributes()

Ben Chavet ben at chavet.net
Sun Jan 11 20:22:06 PST 2004


I hate to reply to myself...espeically so soon, but I did figure out what I
needed:

======
$criteria['OR'] = array(
     array('AND' => array(
               array('field' => 'name',
                     'op' => '=',
                     'test' => 'gallery'),
               array('field' => 'value',
                     'op' => '=',
                     'test' => $this->getName()))));
$value = $this->_shareOb->_categories->getCategoriesByAttributes($criteria);
======

Sorry for all of the noise.

--Ben


Quoting Ben Chavet <ben at chavet.net>:

> Here is the code snipit I'm having problems with:
>
> ======
> $criteria['OR'] = array(
>     array('AND' => array(
>         array('field' => 'gallery',
>                          'op' => '=',
>                          'test' => $this->getName()))));
> $value = $this->_shareOb->_categories->getCategoriesByAttributes($criteria);
> ======
>
> $value is always a db_error where getMesasge() returns "DB Error: unknown
> error"
>
> The SQL query I get is "SELECT DISTINCT a1.category_id, c.category_name FROM
> horde_categories c LEFT JOIN horde_category_attributes a1 ON a1.category_id =
> c.category_id WHERE c.group_uid = 'horde.shares.ansel' AND
> ((a1.attribute_gallery = 'gallery41')) AND a1.attribute_name =
> a1.attribute_name"
>
> When I paste that query directly into posgtres, it returns "ERROR:  No such
> attribute a1.attribute_gallery"
>
> Any ideas?
>
> Thanks,
> Ben
>
>
>
>
> Quoting Marko Djukic <mdjukic at horde.org>:
>
> > look at what i just committed.
> >
> > Quoting Ben Chavet <ben at chavet.net>:
> >
> > > I'm having a difficult time getting getCategoriesByAttributes() to do
> what
> > I
> > > want it to do.  I want to get a list of categories where the attribute
> > > 'gallery' is a specific value.  I've been trying to sift through the
> > function
> > > code to see what I need to send it, but have had no luck.  The SQL it
> > > generates
> > > is way beyond me.  Any help would be appreciated!
> > >
> > > Thanks,
> > > Ben
> > >
> > > ----------------------------------------------------------------
> > > This message was sent using IMP, the Internet Messaging Program.
> > >
> > > --
> > > Horde developers mailing list
> > > Frequently Asked Questions: http://horde.org/faq/
> > > To unsubscribe, mail: dev-unsubscribe at lists.horde.org
> > >
> >
> >
> > --
> > Marko Djukic
> > Horde Project (http://horde.org)
> >
> > --
> > Horde developers mailing list
> > Frequently Asked Questions: http://horde.org/faq/
> > To unsubscribe, mail: dev-unsubscribe at lists.horde.org
> >
>
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
> --
> Horde developers mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: dev-unsubscribe at lists.horde.org
>


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


More information about the dev mailing list