-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
attribute name not equal to parent name issue #7
Comments
you mean a class like this one: does it fail when you call $object = new treenode(); |
yes. a simple example is here address, customer_address, shipping_address are all child of address class $inv = new Invoice(); 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? |
You are right it won't work as the generator generates code like these: /**
which should be : /**
There should be a way to choose the class for these fields. Have a nice day! |
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. |
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 |
I've read the code right now. I need more time for a further review. $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? (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. |
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? |
You are right, I'm sorry. So sorry. |
hey guys,
when i create an object which has two attributes with different names which refer the same parent type, one attribute name has to be different than the parent name. this is creating an issue when we call object->GetAttribut2 function.
is there a workaround to this?
Rgds
Rifky
The text was updated successfully, but these errors were encountered: