POG 2.5 released.

5 views
Skip to first unread message

Joel

unread,
Nov 26, 2006, 12:31:31 AM11/26/06
to Php Object Generator
2.5 has finally been released and promoted to the homepage:
http://www.phpobjectgenerator.com

The source code can be downloaded from the SVN repository or from
sourceforge. Details here:
http://www.phpobjectgenerator.com/plog/article/51/pog-source-code-locations

The documentation has been updated and the pdfs can be downloaded here:
http://www.phpobjectgenerator.com/plog/tutorials

As always if you notice bugs that have been missed by QA, let us know.
we'll beat the cr*p out of our test monkeys.

Regards,
The POG Team.

Paris Paraskeva

unread,
Nov 27, 2006, 2:17:05 AM11/27/06
to Php-Object...@googlegroups.com
Very well done joel, I see many changes that will make many of us happy and
our life easier :)

3. Implemented Sibling (many-many) relations.
Is there a tutorial / example / documentation for this?
quite interesting but would like to read a lot about it before trying to use
it.

7. queries containing "OR"
this is VERY interesting :) any info on how to do queries using OR?

Regards,

Paris Paraskeva
Managing Director
M.E. & E. UnitedWorx Ltd
33, Apostolou Pavlou Avenue, Office 103, 8046 Paphos, Cyprus
Tel.: +357 26220707, +357 26221313, Mob.: +357 99575501
Fax.: +357 26221002
pa...@unitedworx.com
www.unitedworx.com

The information contained in this email message(and any attachments) is
legally privileged and confidential information intended only for the use of
the addressee(s) listed on this email. If the reader of this message is not
the intended recipient you are hereby notified that any dissemination,
distribution or copy of this email is strictly prohibited. If you have
received this email in error, please notify us by telephone or email on the
contact details shown on the end of this email. Thank you.

Regards,
The POG Team.


__________ NOD32 1882 (20061124) Information __________

This message was checked by NOD32 antivirus system.
http://www.eset.com


Joel

unread,
Nov 27, 2006, 2:23:29 AM11/27/06
to Php Object Generator
Hi Paris,

the documentation link above points to the latest documentation. In
particular, this document should tell you what you need to know about
siblings: http://www.phpobjectgenerator.com/plog/file_download/21 or
other relations.

queries containing or are simple. all you need to pass to Get%List
functions is something like this:

array( array(condition1, = , value1), array('or'), array(condition2, >,
value2))

which is equivalent to (Condition1 = value1) OR (condition2 > value2)

More about DNF queries can be found
here:http://www.phpobjectgenerator.com/plog/file_download/15

hope this helps
joel

Paris Paraskeva

unread,
Nov 27, 2006, 9:33:13 AM11/27/06
to Php-Object...@googlegroups.com
Got it Joel thanks. Will play with many to many in a couple of days and see
what it get out of it.

A quick question thought

How do I do this kind of query?

( Value>20 AND value<100) AND (type=1 OR type=3) AND (promote=1 OR
promote=5)


Regards,

Paris Paraskeva
Managing Director
M.E. & E. UnitedWorx Ltd
33, Apostolou Pavlou Avenue, Office 103, 8046 Paphos, Cyprus
Tel.: +357 26220707, +357 26221313, Mob.: +357 99575501
Fax.: +357 26221002
pa...@unitedworx.com
www.unitedworx.com

The information contained in this email message(and any attachments) is
legally privileged and confidential information intended only for the use of
the addressee(s) listed on this email. If the reader of this message is not
the intended recipient you are hereby notified that any dissemination,
distribution or copy of this email is strictly prohibited. If you have
received this email in error, please notify us by telephone or email on the
contact details shown on the end of this email. Thank you.


-----Original Message-----
From: Php-Object...@googlegroups.com
[mailto:Php-Object...@googlegroups.com] On Behalf Of Joel
Sent: Monday, November 27, 2006 9:23 AM
To: Php Object Generator


Hi Paris,

hope this helps
joel


__________ NOD32 1883 (20061127) Information __________

Joel

unread,
Nov 27, 2006, 10:16:14 AM11/27/06
to Php Object Generator
The query you suggested is not in DNF
(http://en.wikipedia.org/wiki/Disjunctive_normal_form), and therefore
would not be handled correctly by POG at this point.

Therefore, to get this working, you would need to find the logical
equivalence in DNF and then pass it to POG. Since all formulae can be
converted into DNF, it should, in theory be possible. (though tedious
maybe?)

Regards,
Joel

Crispy

unread,
Nov 28, 2006, 8:28:48 PM11/28/06
to Php Object Generator
Hi,
just 'cause I like some puzzles:

( Value>20 AND value<100) AND (type=1 OR type=3) AND (promote=1 OR
promote=5)
equivalent to: (A and B) and (C or D) and (E or F)
DNF: (A and B and C and E) or (A and B and C and F) or (A and B and D
and E) or (A and B and D and F)
There's probably a simplified form ;-)
QED

Paris Paraskeva

unread,
Nov 29, 2006, 10:10:23 AM11/29/06
to Php-Object...@googlegroups.com
I know that you can make up any query to a DNF form. However
programmatically is not efficient. It would be better IMHO if POG allowed us
to make up structures of parenthesis of ANDs and OR.

These complex queries are needed mostly on searches of complex types. i.e a
property.

The following code makes up the filter needed for a property search based
on, status,location,type,bedrooms,sleeps,price from,price to,fererence

I would love to allow my user to select multible locations and muiltible
types of other attributes. However with the current POG limitations this is
a problem. If a struggle I might be able to do it, however the whole idea
behind pog is to make things easier and simpler and not complex.


My working code dealing with only one location.

$filter = array();
$filter[] = array("propertyid", ">", 0);

if ($status=='rent'){
$filter[] = array("status", ">=", 1); // for rent
$filter[] = array("status", "<=", 2); // rented
}
elseif ($status=='sale'){
$filter[] = array("status", ">=", 3); //for sale
$filter[] = array("status", "<=", 4); //sold
}
if ($locationid!=0){
$filter[] = array("locationid", "=", $locationid);
}
if ($typeid!=0){
$filter[] = array("propertytypeid", "=", $typeid);
}
if ($bedrooms!=0){
$filter[] = array("bedrooms", ">=", $bedrooms);
}
if ($sleeps!=0){
$filter[] = array("sleeps", ">=", $sleeps);
}
if ($price!=0){
list ($fromprice, $toprice) = split ('[-]', $price);
$filter[] = array("price", ">=", $fromprice);
$filter[] = array("price", "<=", $toprice);
}
if ($reference!='Ref.'){
$filter[] = array("reference", "LIKE", "%$reference%");
}

In a dream world I would be able to replace the section of my code for the
location with the following concept to allow it to cope with multiple
selections.
A concept dream code for the location if I wanted to give my user the
ability to select multiple locations.

if ($locations)>0){
foreach ($locations as $location)
$filter[] = array("("); {
$filter[] = array("locationid", "=", $location->locationid);

$filter[] = array("OR");
}
$filter[] = array(")");

Basicaly like now that POG allows us to set that the next condition is an OR
instead of AND, it would be a dream if there was a way that we could group
conditions together. I hope I am not confusing and I am not thinking wrong.
All I need is to get over some POG limitations in GetList by making my life
easier and not harder.


Regards,

Paris Paraskeva
Managing Director
M.E. & E. UnitedWorx Ltd
33, Apostolou Pavlou Avenue, Office 103, 8046 Paphos, Cyprus
Tel.: +357 26220707, +357 26221313, Mob.: +357 99575501
Fax.: +357 26221002
pa...@unitedworx.com
www.unitedworx.com

The information contained in this email message(and any attachments) is
legally privileged and confidential information intended only for the use of
the addressee(s) listed on this email. If the reader of this message is not
the intended recipient you are hereby notified that any dissemination,
distribution or copy of this email is strictly prohibited. If you have
received this email in error, please notify us by telephone or email on the
contact details shown on the end of this email. Thank you.


-----Original Message-----
From: Php-Object...@googlegroups.com
[mailto:Php-Object...@googlegroups.com] On Behalf Of Crispy
Sent: Wednesday, November 29, 2006 3:29 AM
To: Php Object Generator


__________ NOD32 1888 (20061128) Information __________

andy law (RI)

unread,
Nov 29, 2006, 10:29:22 AM11/29/06
to Php-Object...@googlegroups.com
Here is some code I knocked up in a (rare) idle moment. Would this be
helpful to anyone?

Assuming....


( Value>20 AND value<100) AND (type=1 OR type=3) AND (promote=1 OR
promote=5)

Usage is along the lines of....

$valC = new sqlConstraintList();
$valC->addNewConstraint("value", ">", 20);
$valC->addNewConstraint("value", "<", 100);

$typeC = new sqlConstraintList("OR");
$typeC->addNewConstraint("type", "=", 1);
$typeC->addNewConstraint("type", "=", 3);

$promC = new sqlConstraintList("OR");
$promC->addNewConstraint("promote", "=", 1);
$promC->addNewConstraint("promote", "=", 5);

$scl = new sqlConstraintList();
$scl->addConstraint( $valC);
$scl->addConstraint( $typeC);
$scl->addConstraint( $promC);

$scl->dumpConstraints();

...and I *think* it works.


<?php
/*
* class to handle constraints in a SQL query
*/

function sqlconstraintdumper ($sc){
return "(" . $sc->dumpConstraints(). ")";
}

class sqlconstraint
{
var $fieldName;
var $comparator;
var $value;

function sqlconstraint( $field, $comparator, $value) {
$this->field = $field;
$this->comparator = $comparator;
$this->value = $value;
}

function dumpConstraints() {
return sprintf( "`%s` %s '%s'", $this->field,
$this->comparator, $this->value);
}
}


class sqlconstraintList extends sqlconstraint
{
var $combinator;
var $constList = array();

function sqlconstraintList( $combinator = "AND") {
$this->combinator = $combinator;
}

function dumpConstraints() {
return join( " " . $this->combinator . " ", array_map(
sqlconstraintdumper, $this->constList));
}

function addConstraint( $constraint) {
$this->constList[] = $constraint;
}

function addNewConstraint( $field, $comparator, $value) {
$this->constList[] = new sqlconstraint($field,
$comparator, $value);
}
}

?>

Later,

Andy

-------------
Yada, yada, yada...

The information contained in this e-mail (including any attachments) is
confidential and is intended for the use of the addressee only. The
opinions expressed within this e-mail (including any attachments) are
the opinions of the sender and do not necessarily constitute those of
Roslin Institute (Edinburgh) ("the Institute") unless specifically
stated by a sender who is duly authorised to do so on behalf of the
Institute.

Joel

unread,
Nov 29, 2006, 11:53:21 AM11/29/06
to Php Object Generator
awesome... ;)

thanks for sharing.

andy law (RI)

unread,
Nov 29, 2006, 4:45:26 PM11/29/06
to Php-Object...@googlegroups.com
Joel et al.,

> awesome... ;)
>
> thanks for sharing.


If that's aimed at me, then 'No worries' (and no, I am not Australian)


We/you could easily extend this to fit into the GetList routine to optimise the queries. For example, if a sqlconstraint (and hence a sqlconstraintList) can be queried to see if it is 'encoding-safe' then you could populate the list directly instead of going through the fetch ID, tinker, fetch object dance that we currently use.


If, as we previously discussed briefly, we can extend POG objects to 'know' if a given field for a given object is encoded, the same approach can be extended further. If I have an attribute that I know I'm going to be searching by substring, I might then choose to store that field un-encoded which would render any constraint against that field 'safe' where it would not previously have been so.

I suspect I'm not explaining this well, so I'll try to generate some example code if time permits (unlikely this week or next I'm afraid).

winmail.dat

Crispy

unread,
Nov 29, 2006, 8:00:55 PM11/29/06
to Php Object Generator
> I know that you can make up any query to a DNF form. However
> programmatically is not efficient. It would be better IMHO if POG allowed us
> to make up structures of parenthesis of ANDs and OR.

Hi Paris,
I agree - it isn't efficient - and often confusing to read DNF form. In
case you were thinking me an ass for my reply, I didn't mean to be. I
thought I would explode this as an example for someone reading the
group and didn't see the way to do it.

Paris Paraskeva

unread,
Dec 1, 2006, 6:38:58 AM12/1/06
to Php-Object...@googlegroups.com
I am trying to use sibling relationships in a property and type objects and
I am stuck on making up the multiple selection box. The relations are saved
in the map table correctly but am having difficulty populating the multiple
selection box using the GET{sibling}List methods, mainly it's not clear on
what fields I can use in these filters.

Here is my code for making up the type selection list for a property, below
I have the links for both objects.


Any help will be much appreciated

// make up the type selection list
$propertytype = new propertytype();
$propertytypeList =
$propertytype->GetList(array(array("propertytypeid", ">", 0)),
"sortweight");
$propertytypeListOptions = '';
foreach ($propertytypeList as $propertytype){

$existing =
$property->GetPropertytypeList(array(array("m.propertytypeid", "=",
$propertytype->propertytypeId)));
print_r($existing);
echo $property->propertyId;
if (count($existing)>0){ $selected =
'selected="selected"'; } else { $selected = ''; }
$propertytypeListOptions .= '<option
value="'.$propertytype->propertytypeId.'"
'.$selected.'>'.$propertytype->name.'</option>';
}


http://www.phpobjectgenerator.com/?language=php4&wrapper=pog&objectName=prop
ertytype&attributeList=array+%28%0A++0+%3D%3E+%27name%27%2C%0A++1+%3D%3E+%27
property%27%2C%0A++2+%3D%3E+%27sortweight%27%2C%0A%29&typeList=array+%28%0A+
+0+%3D%3E+%27VARCHAR%28255%29%27%2C%0A++1+%3D%3E+%27JOIN%27%2C%0A++2+%3D%3E+
%27FLOAT%27%2C%0A%29

http://www.phpobjectgenerator.com/?language=php4&wrapper=pog&objectName=prop
erty&attributeList=array+%28%0A++0+%3D%3E+%27name%27%2C%0A++1+%3D%3E+%27refe
rence%27%2C%0A++2+%3D%3E+%27propertytype%27%2C%0A++3+%3D%3E+%27location%27%2
C%0A++4+%3D%3E+%27price%27%2C%0A++5+%3D%3E+%27pricetype%27%2C%0A++6+%3D%3E+%
27description%27%2C%0A++7+%3D%3E+%27status%27%2C%0A++8+%3D%3E+%27levels%27%2
C%0A++9+%3D%3E+%27bedrooms%27%2C%0A++10+%3D%3E+%27bathrooms%27%2C%0A++11+%3D
%3E+%27areacovered%27%2C%0A++12+%3D%3E+%27areaplot%27%2C%0A++13+%3D%3E+%27ar
eaveranda%27%2C%0A++14+%3D%3E+%27investment%27%2C%0A++15+%3D%3E+%27propertyi
mage%27%2C%0A++16+%3D%3E+%27sortweight%27%2C%0A++17+%3D%3E+%27urlalias%27%2C
%0A++18+%3D%3E+%27project%27%2C%0A++19+%3D%3E+%27propertyfeatures%27%2C%0A++
20+%3D%3E+%27promote%27%2C%0A++21+%3D%3E+%27propertyprices%27%2C%0A++22+%3D%
3E+%27propertycategory%27%2C%0A++23+%3D%3E+%27sleeps%27%2C%0A++24+%3D%3E+%27
rating%27%2C%0A%29&typeList=array+%28%0A++0+%3D%3E+%27VARCHAR%28255%29%27%2C
%0A++1+%3D%3E+%27VARCHAR%28255%29%27%2C%0A++2+%3D%3E+%27JOIN%27%2C%0A++3+%3D
%3E+%27BELONGSTO%27%2C%0A++4+%3D%3E+%27INT%27%2C%0A++5+%3D%3E+%27VARCHAR%282
55%29%27%2C%0A++6+%3D%3E+%27TEXT%27%2C%0A++7+%3D%3E+%27VARCHAR%28255%29%27%2
C%0A++8+%3D%3E+%27INT%27%2C%0A++9+%3D%3E+%27INT%27%2C%0A++10+%3D%3E+%27INT%2
7%2C%0A++11+%3D%3E+%27INT%27%2C%0A++12+%3D%3E+%27INT%27%2C%0A++13+%3D%3E+%27
INT%27%2C%0A++14+%3D%3E+%27TEXT%27%2C%0A++15+%3D%3E+%27HASMANY%27%2C%0A++16+
%3D%3E+%27FLOAT%27%2C%0A++17+%3D%3E+%27VARCHAR%28255%29%27%2C%0A++18+%3D%3E+
%27BELONGSTO%27%2C%0A++19+%3D%3E+%27HASMANY%27%2C%0A++20+%3D%3E+%27VARCHAR%2
8255%29%27%2C%0A++21+%3D%3E+%27HASMANY%27%2C%0A++22+%3D%3E+%27JOIN%27%2C%0A+
+23+%3D%3E+%27INT%27%2C%0A++24+%3D%3E+%27INT%27%2C%0A%29


Regards,

A quick question thought


Regards,


Hi Paris,

hope this helps
joel

__________ NOD32 1884 (20061127) Information __________

Paris Paraskeva

unread,
Dec 1, 2006, 7:04:11 AM12/1/06
to Php-Object...@googlegroups.com
The sql query code that is generated by this sibling list (if I skip the m.
then the attribute is ambiguous)
$existing = $propertytype->GetPropertyList(array(array("m.propertyid", "=",
$property->propertyId)));

Is:

select distinct(a.propertyid) from `property` a INNER JOIN
`propertypropertytypemap` m ON m.propertyid = a.propertyid where
m.propertytypeid = '10' AND `m.propertyid` = '30' order by m.propertyid asc

where I think the correct one should be:

select distinct(a.propertyid) from `property` a INNER JOIN
`propertypropertytypemap` m ON m.propertyid = a.propertyid where
m.propertytypeid = '10' AND m.`propertyid` = '30' order by m.propertyid asc

`m.propertyid` does not work where m.`propertyid` works fine.

However im not sure is the GetPropertyList filters should refer to the
property table, propertytype table or the propertypropertytypemap table.

Joel? Have I confused you? Is this a bug or there is another way to generate
the list of types with the slelected ones set.


Regards,


Regards,

A quick question thought


Regards,


Hi Paris,

hope this helps
joel

__________ NOD32 1895 (20061201) Information __________

Paris Paraskeva

unread,
Dec 1, 2006, 8:28:31 AM12/1/06
to Php-Object...@googlegroups.com
Yet another sibling problem

The following code returns only the first type of a property instead of
both(or more). The pog query which is generated fetches both types however
the list that is returned does not contain both. Unless I am doing something
wrong here

//get the property types
$propertytypelist = $property->GetPropertytypeList();
$propertytypes = "";
foreach ($propertytypelist as $propertytype){
$propertytypes .= $propertytype->name." ";
}


This is a workaround I made up but the above should have worked.

//get the property types //WORKAROUND


$propertytypeList =
$propertytype->GetList(array(array("propertytypeid", ">", 0)),
"sortweight");

foreach ($propertytypeList as $propertytype){
$existing =

$propertytype->GetPropertyList(array(array("propertyid", "=",
$property->propertyId)));
if (count($existing)>0){ $propertytypes .=
$propertytype->name." "; }

Paris Paraskeva

unread,
Dec 1, 2006, 9:32:08 AM12/1/06
to Php-Object...@googlegroups.com

Found the problem I think for $propertytypelist =
$property->GetPropertytypeList(); to work properly.

The code fragment below that is generated by pog in class.property.php needs
to create a new property object at every run of the for loop for
GetPropertytypeList() to function correctly.


$Database->Query($this->pog_query);
for($i=0; $i < $Database->Rows(); $i++)
{
$property = new property(); // CODE LINE ADDED
MANUALLY
$propertytype->Get($Database->Result($i,
"propertytypeid"));
$propertytypeList[] = $propertytype;
}

Joel or anyone can you confirm this?

Joel

unread,
Dec 2, 2006, 2:43:33 PM12/2/06
to Php Object Generator
Hi Paris,

the filters you can pass to Get{sibling}List is similar to
Get{Children}List, i.e. you need to pass an array of arrays with column
names for the sibling:

in your case you can do something like this:

$existing = $propertytype->GetPropertyList(array(array("propertyid",

">",
5)));

This should return all property types of all properties whose id > 5

There is no need to reference the mapping table at all in GetList. Use
Get{Sibling} List exactly as you would for GetChildren List and you
should be ok. (I think you figured that one out already)


As for your last 2 emails, indeed, you're correct. There's a bug in the
generator for PHP4.... I've double checked and this does not seem to
happen for php5 & 5.1

Thanks for the note. This will be fixed asap and I'll send a note when
done.

Regards,
Joel

Joel

unread,
Dec 2, 2006, 3:03:35 PM12/2/06
to Php Object Generator
The bug has been fixed, the main page refreshed

http://www.phpobjectgenerator.com

Both code repositories (Subversion and Sourceforge) have also been
updated.

Thanks again,

Joel

Joel

unread,
Dec 2, 2006, 9:42:20 PM12/2/06
to Php Object Generator
By the way, after some more investigation, (because I wanted to know
why our tests did not catch this bug before), it seems that the bug is
only noticed if code generated for php4 is run on php 5+

Paris, can you confirm this if you have a min?

I tried to run the code generated before the bug fix on our PHP 4.4.4
virtual machine and the problem does not occur. This makes sense since
in PHP 4, $array[] = $object actually copies the object whereas in
php5, it passes the object by reference.

Regards,
Joel

Paris Paraskeva

unread,
Dec 3, 2006, 9:01:48 AM12/3/06
to Php-Object...@googlegroups.com
Joel I will confirm this later on today or tomorrow. (I am using PHP Version
4.3.9 online, but on local server for development its PHP Version 5.1.1)
(hmm I need to do something about this)
I have patched the objects myself in order to make things work. Will back up
mine and regenerate the objects and see if things work for both problems I
had. I was hoping to publish the respective website online today, but I
guess I will delay it a bit in order to check things and report back.

BTW once I have played with siblings a bit, it's a great help having them ;)
instead of making many to many relationships manually. POG Rocks :)


Regards,

Paris Paraskeva
Managing Director
M.E. & E. UnitedWorx Ltd
33, Apostolou Pavlou Avenue, Office 103, 8046 Paphos, Cyprus
Tel.: +357 26220707, +357 26221313, Mob.: +357 99575501
Fax.: +357 26221002
pa...@unitedworx.com
www.unitedworx.com

The information contained in this email message(and any attachments) is
legally privileged and confidential information intended only for the use of
the addressee(s) listed on this email. If the reader of this message is not
the intended recipient you are hereby notified that any dissemination,
distribution or copy of this email is strictly prohibited. If you have
received this email in error, please notify us by telephone or email on the
contact details shown on the end of this email. Thank you.


-----Original Message-----
From: Php-Object...@googlegroups.com
[mailto:Php-Object...@googlegroups.com] On Behalf Of Joel
Sent: Sunday, December 03, 2006 4:42 AM
To: Php Object Generator

Regards,
Joel


__________ NOD32 1897 (20061201) Information __________

Paris Paraskeva

unread,
Dec 4, 2006, 1:40:56 PM12/4/06
to Php-Object...@googlegroups.com
Joel, I can confirm now that the new generated objects work just fine.
And 36 POG objects generate this http://www.villasrentcyprus.com and its not
even feature complete yet ;) but online so client can fill it up with info.

Will convert some other features I've done to siblings and I'll see if I get
any other probs. And the fun goes on.

Again congrats for the siblings it's a nifty new pog feature.


Regards,

Paris Paraskeva
Managing Director
M.E. & E. UnitedWorx Ltd
33, Apostolou Pavlou Avenue, Office 103, 8046 Paphos, Cyprus
Tel.: +357 26220707, +357 26221313, Mob.: +357 99575501
Fax.: +357 26221002
pa...@unitedworx.com
www.unitedworx.com

The information contained in this email message(and any attachments) is
legally privileged and confidential information intended only for the use of
the addressee(s) listed on this email. If the reader of this message is not
the intended recipient you are hereby notified that any dissemination,
distribution or copy of this email is strictly prohibited. If you have
received this email in error, please notify us by telephone or email on the
contact details shown on the end of this email. Thank you.


-----Original Message-----
From: Php-Object...@googlegroups.com
[mailto:Php-Object...@googlegroups.com] On Behalf Of Joel
Sent: Sunday, December 03, 2006 4:42 AM
To: Php Object Generator

Subject: [Php-Object-Generator:818] Re: Sibling relationship problem

Regards,
Joel


__________ NOD32 1897 (20061201) Information __________

cvokk

unread,
Dec 6, 2006, 9:07:58 AM12/6/06
to Php Object Generator
Hi Joel,
I think I have found a bug (or maybe I am using the objects the wrong
way) in the script where you are retrieving childrens. Consider this
scenario:

$item = new Object();
$itemList = $item->Get{Child}List($firstSetOfRules);
some work with $itemList
now - the problem
$itemList2 = $item->Get{Child}List($secondSetOfRules);
$itemList2 will now contain all the records of previously inicialized
$itemList + the records which match $secondSetOfRules

the problem is here (strip from one of my objects):
function GetSitemenuitemList($fcv_array = array(), $sortBy='',
$ascending=true, $limit='')
{
$sitemenuitem = new SiteMenuItem();
$fcv_array[] = array("sitemenuId", "=", $this->sitemenuId);
$dbObjects = $sitemenuitem->GetList($fcv_array, $sortBy, $ascending,
$limit);
foreach ($dbObjects as $dbObject)
{
>>>> $this->AddSitemenuitem($dbObject);
}
return $this->_sitemenuitemList;
}

Witch each consecutive calls to Get{child}List the _sitemenuitemList
will grow and will contain records of all previous calls to
Get{child}List as well.
I do not know if this is meant to be this way, I think it is a bit
confusing. Of course, everytime you want to call Get{child}List you can
make new Object() and than call the method but I do not know if this is
wanted behaviour. If it is, than sorry for my misunderstanding.
Solution to this - either reset child list before each call or call the
method only on new objects.
Regards and keep up the good work.
Vitek.

Joel

unread,
Dec 6, 2006, 8:39:59 PM12/6/06
to Php Object Generator
Hi Vitek,

I agree the behavior is confusing.... I think, you're correct, it'll
have to change.
thanks for the valuable feedback.

Joel

Reply all
Reply to author
Forward
0 new messages