Comments (8)
you mean a class like this one:
does it fail when you call
$object = new treenode();
[...]
$child = $object->GetChild();
from php-object-generator.
yes. a simple example is
here address, customer_address, shipping_address are all child of address class
$inv = new Invoice();
[...]
$inv_address = $inv->GetAddress(); <-------- this will work
$inv_shippingaddress = $inv->GetShipping_address(); <-------- this is not working...
i think if we can mention the parent or child original class name and then generate objects will solve the issue.
is the same error occuring for you?
from php-object-generator.
You are right it won't work as the generator generates code like these:
/**
- Associates the shipping_address object to this one
- @return boolean
/
function GetShipping_address()
{
$shipping_address = new shipping_address();
return $shipping_address->Get($this->shipping_addressId);
}
/* - Associates the shipping_address object to this one
- @return boolean
- @return
*/
function SetShipping_address(&$shipping_address)
{
$this->shipping_addressId = $shipping_address->shipping_addressId;
}
which should be :
/**
- Associates the shipping_address object to this one
- @return boolean
/
function GetShipping_address()
{
$shipping_address = new address();
return $shipping_address->Get($this->shipping_addressId);
}
/* - Associates the shipping_address object to this one
- @return boolean
- @return
*/
function SetShipping_address(&$shipping_address)
{
$this->shipping_addressId = $shipping_address->addressId;
}
There should be a way to choose the class for these fields.
The generator doesn't have enough information.
I'll see if I can add that funcionality as soon as possible.
Change the code of the class by yourself meanwhile.
Have a nice day!
from php-object-generator.
i have changed the coding on my local server and it's working now.. i'll try to upload it to git asap so that you can review it.
i mean the pog code.
from php-object-generator.
Loksly,
i have changed the coding to accept parent object name. can you revise and see whether it's ok.
mean time any idea of incorporating prepared statements in to pog? is using prepared statements rather than direct script will cause performance issue in pog?
rgds
Rifky
from php-object-generator.
I've read the code right now. I need more time for a further review.
I've seen you've change the wsdl for adding a new parameter (classlist),
that breaks backwards compatibility and I think joel should be the one
who has to be agree with that before accepting the commit. I agree with you
with the use of jquery. It works fine and is expected to working fine in the future.
About using prepared statements there are some issues. There should be a way
to choose if you want the generated code to use them or not. It's easy to generate
code for a Get, Insert and Delete functions and harder for a GetList or for a DeleteList functions.
I think is a mistake to break compatibility with code already generated. Imaging a code like this:
$restrictions = array();
$restrictions[] = array( 'year','<',date('Y') );
$restrictions[] = array( ' and exists (select * invoices where invoices.`deleted`=0 and invoices.project=project.projectId )' );
$projects = $project->GetList($restrictions,'title');
What kind of code for GetList do you suggest?
This kind?
(GetList function)
...
$counter = 0;
$params = array();
for ($i=0, $c=sizeof($fcv_array); $i<$c; $i++)
{
if (sizeof($fcv_array[$i]) == 1)
{
$this->pog_query .= " ".$fcv_array[$i][0]." ";
continue;
}
else
{
if ($i > 0 && sizeof($fcv_array[$i-1]) != 1)
{
$this->pog_query .= " AND ";
}
if (isset($this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes']) && $this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'NUMERIC' && $this->pog_attribute_type[$fcv_array[$i][0]]['db_attributes'][0] != 'SET')
{
if ($GLOBALS['configuration']['db_encoding'] == 1)
{
$value = POG_Base::IsColumn($fcv_array[$i][2]) ? "BASE64_DECODE(".$fcv_array[$i][2].")" : "'".$fcv_array[$i][2]."'";
$this->pog_query .= "BASE64_DECODE(`".$fcv_array[$i][0]."`) ".$fcv_array[$i][1]." ".$value;
}
else
{
if (POG_Base::IsColumn($fcv_array[$i][2]))
{
$value = POG_Base::IsColumn($fcv_array[$i][2]) ? $fcv_array[$i][2] : "'".$this->Escape($fcv_array[$i][2])."'";
$this->pog_query .= "`".$fcv_array[$i][0]."` ".$fcv_array[$i][1]." ".$value;
}else{
$value = POG_Base::IsColumn($fcv_array[$i][2]) ? $fcv_array[$i][2] : "'".$this->Escape($fcv_array[$i][2])."'";
$this->pog_query .= "`".$fcv_array[$i][0]."` ".$fcv_array[$i][1]." :param".$counter;
$params[':param'.$counter] = $value;
$counter++;
}
}
}
else
{
$value = POG_Base::IsColumn($fcv_array[$i][2]) ? $fcv_array[$i][2] : "'".$fcv_array[$i][2]."'";
$this->pog_query .= "`".$fcv_array[$i][0]."` ".$fcv_array[$i][1]." ".$value;
}
}
}
if (counter>0)
{
$preparedStatement = Database::PreparedStatement($this->pog_query);
foreach($params as $name => $val)
$preparedStatement->bindParam($name,$val);
$preparedStatement->execute()
}else{
//current code
}
//Note: I've written this code here (& without any test)
As I have said before, we have to see if the new code works properly with the one users of pog might have written.
About performance I've read is not very appreciable. Better table/database design increases performance more significantly. I guess security (SQL injection prevention) is a better reason for using prepared statements.
from php-object-generator.
I think running the existing unit tests as well as creating new ones to validate backward compatibility of existing plugins should be a pre-requisite before code can be merged. Thoughts?
from php-object-generator.
You are right, I'm sorry.
I did the commit/merge using the mobile phone.
I'll check the code tonight (in about 5 hours).
I already read it and it looks like it works.
I confess I haven't run the tests as I should.
So sorry.
from php-object-generator.
Related Issues (13)
- url probleme HOT 1
- Couldn't Insert the Data in Form to DB HOT 1
- Remove usage of PHP Shorttags HOT 1
- problem on index.php HOT 1
- remote soap service is down HOT 1
- Missing intval in Delete Function
- Download problem
- upgrade to 3.2 HOT 1
- Error
- zip library incompatibility HOT 2
- plugin instantiation at pog_base HOT 1
- using transactions HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from php-object-generator.