Hi Alex,

sorry I completely missed this thread!
Last week however I implemented a extenstion on sfDataSourcePropel,
that allowed me to perform a custom query (not only by defining
criteria, but also by overruling PropelBasePeer to define my own inner-
queries, with nested select-queries). I however still used hydration
to process the results and allow to define relations (and perform
joins).
When I am back at the office monday I will post some of my work, so
you can see how I solved this issue

Regards
Leon

On Oct 1, 3:33 pm, alex knol <[email protected]> wrote:
> Gareth,
>
> That's what I tried at first too, but what if you cannot get data from this
> because it's an aggregate function based on a parameter....
>
> Then you would have to look in the criteria (in the propel case) or DQL (in
> the case of doctrine) to see if the alias is defined and you can count on
> getting the field in the dataset.
>
> Best Regards,
> Alex Knol
> Company: Pumiwex S.L.U.
> Country: Espana
>
> On Thu, Oct 1, 2009 at 3:28 PM, Gareth McCumskey <[email protected]>wrote:
>
> > I didn't realise you were using Doctrine. I have been using Propel pretty
> > much exclusively myself when I get into symfony at 1.0. My thinking is that
> > a solution for Propel would be to just create that method in the tables
> > model class to catch calls to that column and return what the result should
> > be.
>
> > On Thu, Oct 1, 2009 at 2:49 PM, E_lexy <[email protected]> wrote:
>
> >> Hi all,
>
> >> @Gareth, The class doesn't have this method because the column is the
> >> result of an aggregate function in the Doctrine_query
>
> >> I have found a solution for the doctrine way, I guess it will be more
> >> or less the same for Propel.
> >> Don't know if it is the nicest way, feel free to comment
>
> >> The reason sfGrid cannot find the column is because it is looking in
> >> the model, not in the query feeding the datasource.
> >> I have not tested with other kind of datasources, but this seems to
> >> work for Doctrine_query:
>
> >>  /**
> >>   * @see sfDataSourceInterface::requireColumn()
> >>   */
> >>  public function requireColumn($column)
> >>  {
> >>    if (!$this->getTable()->hasColumn($column))
> >>    {
> >>      //var_dump($this->query->getAggregateAlias($column));
> >>      if(!$this->query->getAggregateAlias($column)) {
> >>        throw new LogicException(sprintf('The column "%s" has not been
> >> found in the datasource columns or the model %s', $column, $this-
> >> >getTable()));
> >>      }
> >>    }
> >>  }
>
> >> It checks whether the column you wanted is spcified as an aggregate
> >> alias in the query.
>
> >> On 1 okt, 14:30, Gareth McCumskey <[email protected]> wrote:
> >> > Class "Idea" has no method called "getideaRelationId"
>
> >> > Should your getter not be getIdeaRelationId ... note the case of that i
> >> > after the get. Perhaps in your code you are calling the method with bad
> >> case
>
> >> > On Mon, Sep 7, 2009 at 11:34 AM, E_lexy <[email protected]> wrote:
>
> >> > > I am trying to use sfGrid based on a custom query-datasource.
> >> > > This custom query contains a result of a calculated field.
> >> > > Symfony complains a bout not being able to find a setter. <-
> >> > > understandable.
>
> >> > > I believe i need make a setter, but where? in Idea?
>
> >> > > Datasource:
> >> > > [code]
> >> > > object(sfDataSourcePropel)[81]
> >> > >  protected 'data' => null
> >> > >  protected 'connection' => null
> >> > >  protected 'baseClass' => string 'Idea' (length=4)
> >> > >  protected 'objectPaths' =>
> >> > >    array
> >> > >      0 => string 'Idea' (length=4)
> >> > >  protected 'selectCriteria' =>
> >> > >    object(Criteria)[82]
> >> > >      private 'ignoreCase' => boolean false
> >> > >      private 'singleRecord' => boolean false
> >> > >      private 'selectModifiers' =>
> >> > >        array
> >> > >          empty
> >> > >      private 'selectColumns' =>
> >> > >        array
> >> > >          empty
> >> > >      private 'orderByColumns' =>
> >> > >        array
> >> > >          empty
> >> > >      private 'groupByColumns' =>
> >> > >        array
> >> > >          empty
> >> > >      private 'having' => null
> >> > >      private 'asColumns' =>
> >> > >        array
> >> > >          'ideaRelationId' => string '(select IdeaRelationID
> >> > >      from IdeaRelations
> >> > >      where State = "E"
> >> > >        and ((SourceID = IdeasListView.IdeaID
> >> > >              and TargetID = )
> >> > >        or (SourceID =
> >> > >              and TargetID = IdeasListView.IdeaID)))' (length=226)
> >> > >      private 'joins' =>
> >> > >        array
> >> > >          empty
> >> > >      private 'dbName' => string 'propel' (length=6)
> >> > >      private 'primaryTableName' => null
> >> > >      private 'originalDbName' => null
> >> > >      private 'limit' => int 10
> >> > >      private 'offset' => int 0
> >> > >      private 'blobFlag' => null
> >> > >      private 'aliases' =>
> >> > >        array
> >> > >          empty
> >> > >      private 'useTransaction' => boolean false
> >> > >      private 'map' =>
> >> > >        array
> >> > >          'idea.ID' =>
> >> > >            object(Criterion)[77]
> >> > >              private 'value' => string 'select id from idea_list_view
> >> > > where id != ' (length=42)
> >> > >              private 'comparison' => string 'CUSTOM' (length=6)
> >> > >              private 'table' => string 'idea' (length=4)
> >> > >              private 'realtable' => null
> >> > >              private 'column' => string 'ID' (length=2)
> >> > >              private 'ignoreStringCase' => boolean false
> >> > >              private 'db' =>
> >> > >                object(DBMySQL)[70]
> >> > >              private 'clauses' =>
> >> > >                array
> >> > >                  empty
> >> > >              private 'conjunctions' =>
> >> > >                array
> >> > >                  empty
> >> > >              private 'parent' => null
> >> > >          'Idea.CUSTOMER_ID' =>
> >> > >            object(Criterion)[79]
> >> > >              private 'value' => int 1
> >> > >              private 'comparison' => string '=' (length=1)
> >> > >              private 'table' => string 'Idea' (length=4)
> >> > >              private 'realtable' => null
> >> > >              private 'column' => string 'CUSTOMER_ID' (length=11)
> >> > >              private 'ignoreStringCase' => boolean false
> >> > >              private 'db' =>
> >> > >                object(DBMySQL)[70]
> >> > >              private 'clauses' =>
> >> > >                array
> >> > >                  empty
> >> > >              private 'conjunctions' =>
> >> > >                array
> >> > >                  empty
> >> > >              private 'parent' => null
> >> > >          'Idea.is_cluster' =>
> >> > >            object(Criterion)[83]
> >> > >              private 'value' => string 'Y' (length=1)
> >> > >              private 'comparison' => string '=' (length=1)
> >> > >              private 'table' => string 'Idea' (length=4)
> >> > >              private 'realtable' => null
> >> > >              private 'column' => string 'is_cluster' (length=10)
> >> > >              private 'ignoreStringCase' => boolean false
> >> > >              private 'db' =>
> >> > >                object(DBMySQL)[70]
> >> > >              private 'clauses' =>
> >> > >                array
> >> > >                  empty
> >> > >              private 'conjunctions' =>
> >> > >                array
> >> > >                  empty
> >> > >              private 'parent' => null
> >> > >  protected 'countCriteria' => null
> >> > >  private 'cursor' => int 0
> >> > >  private 'offset' => int 0
> >> > >  private 'limit' => int 0
> >> > > [/code]
>
> >> > > and the message:
> >> > > [code]
> >> > > Class "Idea" has no method called "getideaRelationId".
> >> > > [/code]
>
> >> > --
> >> > Gareth McCumskeyhttp://garethmccumskey.blogspot.com
> >> > twitter: @garethmcc
>
> > --
> > Gareth McCumskey
> >http://garethmccumskey.blogspot.com
> > twitter: @garethmcc
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to