parent::getActivitylogs($criteria) should return an array of objects
so if you know you are going to get one result you could return
current(parent::getActivitylogs($criteria)) which should be the first
object.
Thanks,
Michael
On Feb 7, 12:03 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> given the follwing (partial) schema...
>
> <table name="Consumer" skipSql="null" abstract="null">
> <column name="id" autoIncrement="true" type="INTEGER"
> required="true" primaryKey="true" autoincrement="true" />
> <column name="first_name" type="VARCHAR" size="255" />
> <column name="last_name" type="VARCHAR" size="255" />
> ....
> </table>
> <table name="Activity" skipSql="null" abstract="null">
> <column name="id" autoIncrement="true" type="INTEGER"
> required="true" primaryKey="true" autoincrement="true" />
> <column name="activitytype_id" type="INTEGER" />
> <foreign-key foreignTable="ActivityType" onDelete="none"
> onUpdate="none">
> <reference local="activitytype_id" foreign="id" />
> </foreign-key>
> <column name="day" type="INTEGER" />
> <column name="hours" type="FLOAT" />
> <column name="log_id" type="INTEGER" />
> <foreign-key foreignTable="Activitylog">
> <reference local="log_id" foreign="id" />
> </foreign-key>
> </table>
> <table name="Activitylog" skipSql="null" abstract="null">
> <column name="id" autoIncrement="true" type="INTEGER"
> required="true" />
> <column name="consumer_id" primaryKey="true" type="INTEGER" />
> <foreign-key foreignTable="Consumer">
> <reference local="consumer_id" foreign="id" />
> </foreign-key>
> <column name="staff_id" primaryKey="true" type="INTEGER" />
> <foreign-key foreignTable="Contact" onDelete="none"
> onUpdate="none">
> <reference local="staff_id" foreign="id" />
> </foreign-key>
> <column name="startdate" primaryKey="true" type="DATE" />
> </table>
>
> I have in Consumer.php
>
> public function getActivitylogsformonth($year = '2008')
> {
> $criteria = new Criteria();
> $criteria->add(ActivitylogPeer::STARTDATE,
> sfTime::firstDayOfMonth(mktime(0,0,0, $this->month,1,$year)),
> Criteria::GREATER_THAN);
> $criteria->addAnd(ActivitylogPeer::STARTDATE,
> sfTime::finalDayOfMonth(mktime(0,0,0,$this->month,1,$year)),
> Criteria::LESS_THAN);
>
> $criteria->addAscendingOrderByColumn(ActivitylogPeer::STARTDATE);
>
> return parent::getActivitylogs($criteria);
> }
>
> but I need it to be an object, so that I can do $consumer-
>
> >getActivitylogsformonth()->getActivitys()
>
> Any pointers
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---