Table with an ID not called "id"

22 views
Skip to first unread message

Ivan

unread,
Nov 9, 2015, 3:01:21 PM11/9/15
to ZnetDK

Hello,

 

I have a sql table that has an id with a different name from « id » :

 

CREATE TABLE IF NOT EXISTS `products` (

 `id_product` int(11) NOT NULL AUTO_INCREMENT,

 

 

In the productsdao.php file, I have define the IdColumnName like this :


protected function initDaoProperties() {
$this->table = " products ";
$this->IdColumnName = "id_product";
}

Now, I have this error:

"DAO-006: the parameter 'rowID' is absent when calling the method 'DAO::remove()' or the properties 'filterValues' and 'filterClause' are not properly set for the class 'app\model\AysDAO' to remove data row! - C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\znetdk\engine\core\dao.php(398)"

 

Please, can you help me?

 

Regards,

Pascal Martinez

unread,
Nov 10, 2015, 5:23:13 PM11/10/15
to ZnetDK
Hi Ivan,

The error message 'DAO-006' is displayed because no row identifier has been specified while calling the DAO::remove() method. 

In your DAO definition, I see that the column storing the row identifier is named 'product_id'.
So, I think that this error happens because the row identifier column of your SQL table is named 'product_id' instead of 'id'.

Try to add the 'zdk-row-id' class to the <input> HTML element of your form that is named 'product_id'.
So, you'll make ZnetDK know that the row identifier to send to the controller action is available within the HTML input field named 'product_id'.

Let me know whether the 'zdk-row-id' class resolves your issue.

Regards,

Pascal MARTINEZ

Ivan

unread,
Nov 12, 2015, 4:29:24 AM11/12/15
to ZnetDK
Hello Pascal,

Thank you for your help,  the 'zdk-row-id' class resolves my issue.:-)

<input class="zdk-row-id" name="product_id" disabled type="text">

Regards,
Ivan
Reply all
Reply to author
Forward
0 new messages