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 <gmccums...@gmail.com> 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 <alexk...@gmail.com> 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to