problem adding a field to an object

13 views
Skip to first unread message

lkasdorf

unread,
Jul 7, 2014, 4:53:21 PM7/7/14
to php-object...@googlegroups.com
I have a pretty complex set of objects with child-parent and sibling relationships, etc. Just recently, I tried adding a couple fields (like I have been doing for many years now in POG), and the resulting code is broken! Example:

/**
* Associates the account object to this one
* @return boolean
*/
function GetAccount()
{
$account = new ();
return $account->Get($this->accountId);
}
Notice the 
new ();

 - it should say 
new account();

I know Joel is not supporting POG any more, but I have become dependent on it- I have used it dozens and dozens of time over the last 6 years or so.

Mario

unread,
Jul 7, 2014, 5:17:14 PM7/7/14
to php-object-generator
Hi lkasdorf,

Thanks for reporting the error.
Please accept my apologies for this problem.



I guess the error comes from line 800 of

where 
$this->string .= "\n\t\t\$".strtolower($parent)." = new ".$class."();";

should be:
$this->string .= "\n\t\t\$".strtolower($parent)." = new ".$parent."();";

as it is on line 786 of file



now it's too late (11PM) for me to check if this is the best way to solve this error.

I'll check it tomorrow in the evening.

Sorry again for the inconvenience, but we'll be working on it soon.


lkasdorf

unread,
Jul 7, 2014, 5:22:48 PM7/7/14
to php-object...@googlegroups.com
Here is the link:
http://www.phpobjectgenerator.com/?language=php5.1&wrapper=pdo&pdoDriver=mysql&objectName=addrInfo&attributeList=array+%28%0A++0+%3D%3E+%27street1%27%2C%0A++1+%3D%3E+%27street2%27%2C%0A++2+%3D%3E+%27street3%27%2C%0A++3+%3D%3E+%27city%27%2C%0A++4+%3D%3E+%27state%27%2C%0A++5+%3D%3E+%27zip%27%2C%0A++6+%3D%3E+%27busPhone%27%2C%0A++7+%3D%3E+%27cellPhone%27%2C%0A++8+%3D%3E+%27homePhone%27%2C%0A++9+%3D%3E+%27email%27%2C%0A++10+%3D%3E+%27emailFlags%27%2C%0A++11+%3D%3E+%27url%27%2C%0A++12+%3D%3E+%27contact%27%2C%0A++13+%3D%3E+%27account%27%2C%0A++14+%3D%3E+%27log%27%2C%0A++15+%3D%3E+%27country%27%2C%0A++16+%3D%3E+%27fax%27%2C%0A++17+%3D%3E+%27isPub%27%2C%0A++18+%3D%3E+%27lat%27%2C%0A++19+%3D%3E+%27lng%27%2C%0A++20+%3D%3E+%27referral%27%2C%0A++21+%3D%3E+%27dispSeq%27%2C%0A++22+%3D%3E+%27misc%27%2C%0A++23+%3D%3E+%27dba%27%2C%0A++24+%3D%3E+%27practiceDesc%27%2C%0A++25+%3D%3E+%27url2%27%2C%0A%29&typeList=array%2B%2528%250A%2B%2B0%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B1%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B2%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B3%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B4%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B5%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B6%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B7%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B8%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B9%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B10%2B%253D%253E%2B%2527BIGINT%2527%252C%250A%2B%2B11%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B12%2B%253D%253E%2B%2527BELONGSTO%2527%252C%250A%2B%2B13%2B%253D%253E%2B%2527BELONGSTO%2527%252C%250A%2B%2B14%2B%253D%253E%2B%2527HASMANY%2527%252C%250A%2B%2B15%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B16%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B17%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B18%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B19%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B20%2B%253D%253E%2B%2527HASMANY%2527%252C%250A%2B%2B21%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B22%2B%253D%253E%2B%2527TEXT%2527%252C%250A%2B%2B23%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2B%2B24%2B%253D%253E%2B%2527TEXT%2527%252C%250A%2B%2B25%2B%253D%253E%2B%2527VARCHAR%2528255%2529%2527%252C%250A%2529&classList=array+%28%0A++0+%3D%3E+%27%27%2C%0A++1+%3D%3E+%27%27%2C%0A++2+%3D%3E+%27%27%2C%0A++3+%3D%3E+%27%27%2C%0A++4+%3D%3E+%27%27%2C%0A++5+%3D%3E+%27%27%2C%0A++6+%3D%3E+%27%27%2C%0A++7+%3D%3E+%27%27%2C%0A++8+%3D%3E+%27%27%2C%0A++9+%3D%3E+%27%27%2C%0A++10+%3D%3E+%27%27%2C%0A++11+%3D%3E+%27%27%2C%0A++12+%3D%3E+%27%27%2C%0A++13+%3D%3E+%27%27%2C%0A++14+%3D%3E+%27%27%2C%0A++15+%3D%3E+%27%27%2C%0A++16+%3D%3E+%27%27%2C%0A++17+%3D%3E+%27%27%2C%0A++18+%3D%3E+%27%27%2C%0A++19+%3D%3E+%27%27%2C%0A++20+%3D%3E+%27%27%2C%0A++21+%3D%3E+%27%27%2C%0A++22+%3D%3E+%27%27%2C%0A++23+%3D%3E+%27%27%2C%0A++24+%3D%3E+%27%27%2C%0A++25+%3D%3E+%27%27%2C%0A%29


Thanks!
Lynn Kasdorf

Mario

unread,
Jul 8, 2014, 5:44:39 AM7/8/14
to php-object-generator
hello Lynn,

can you please check you have fulfil the four textboxes for the classes like in this example? [a,b,c,d]






both domains beta.phpobjectgenerator.com and www.phpobjectgenerator.com seem to generate good code for your link.
Please let me know if that was what caused the error.

Have a nice day.


lkasdorf

unread,
Jul 8, 2014, 10:58:46 AM7/8/14
to php-object...@googlegroups.com
yes- that was it- I was not filling in those fields for the related objects. When I put them in, the code produced was correct.

Note that I don't recall having to enter these table names before- I though by default they would use the same name as the field.

Thanks for looking into this so quickly! 

Mario

unread,
Jul 8, 2014, 1:48:18 PM7/8/14
to php-object...@googlegroups.com

it's good to know everything went good.

If I have to be honest I don't remember when that feature was included.

The class may not have the same name as the attribute, so it's need to know which one is. This is the reason why you are prompted for it.

Maybe the link should include this information. I'll take into consideration if I change this code.

Have a nice day.

--
You received this message because you are subscribed to the Google Groups "Php Object Generator" group.
To unsubscribe from this group and stop receiving emails from it, send an email to php-object-gener...@googlegroups.com.
To post to this group, send email to php-object...@googlegroups.com.
Visit this group at http://groups.google.com/group/php-object-generator.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages