×
This forum has been locked. Please submit new Feature Requests on GitHub: github.com/Jensen-Technologies/component-creator-issues/issues
Unique value field when you save the form
Randy Tobias
New Member
Posts: 4
7 年 10 个月 前 #1479
由 Randy Tobias
Replied by Randy Tobias on topic Unique value field when you save the form
Hi. I'm having a problem with this. Is the uniqueness being enforced via code? I created a unique field, and expected the column in the table to be unique, which it doesn't appear to be. I am interacting with my component's table from an external source, and it is adding several rows with the same email address, even though I had configured that field to be unique in the component creator.
Please 登录 或 注册一个帐号 to join the conversation.
Andres Maeso
Platinum Member
Posts: 338
7 年 9 个月 前 #1480
由 Andres Maeso
Andrés Maeso
Customer relations manager at Joomla Component Creator.
该邮件地址已受到反垃圾邮件插件保护。要显示它需要在浏览器中启用 JavaScript。
Replied by Andres Maeso on topic Unique value field when you save the form
Hi Randy
We can only make sure that uniqueness is correct in Joomla. Unfortunately, there is no way we can predict all possible interactions with external developments, so you will need to take care of that.
Regards,
Andrés.
We can only make sure that uniqueness is correct in Joomla. Unfortunately, there is no way we can predict all possible interactions with external developments, so you will need to take care of that.
Regards,
Andrés.
Andrés Maeso
Customer relations manager at Joomla Component Creator.
该邮件地址已受到反垃圾邮件插件保护。要显示它需要在浏览器中启用 JavaScript。
Please 登录 或 注册一个帐号 to join the conversation.
Randy Tobias
New Member
Posts: 4
7 年 9 个月 前 #1481
由 Randy Tobias
Replied by Randy Tobias on topic Unique value field when you save the form
Hi Andres,
That didn't really answer my question. I had wanted to know why the column in the DB is not set to unique when I mark a field as unique in the component creator. My external integrations have been modified to deal with this, but it makes my development a lot longer and makes my code far less efficient because in have to do a DB query and then and update. This is an extra DB call, plus some processing when just having the column be unique in the DB would do the same, but faster and easier. This is why I ask if there is a reason why the column in the DB is not made unique.
That didn't really answer my question. I had wanted to know why the column in the DB is not set to unique when I mark a field as unique in the component creator. My external integrations have been modified to deal with this, but it makes my development a lot longer and makes my code far less efficient because in have to do a DB query and then and update. This is an extra DB call, plus some processing when just having the column be unique in the DB would do the same, but faster and easier. This is why I ask if there is a reason why the column in the DB is not made unique.
Please 登录 或 注册一个帐号 to join the conversation.
Søren Beck Jensen
Administrator
Posts: 73
7 年 9 个月 前 #1482
由 Søren Beck Jensen
Søren Beck Jensen
Founder, Component-Creator.com
Replied by Søren Beck Jensen on topic Unique value field when you save the form
We use the built in Joomla method for ensuring that fields are unique which places a check in the bind method of the model. This allows Joomla to show better error messages and prevents SQL errors that would otherwise occur if we relied on the UNIQUE field in MySQL.
If you are already developing other extensions on top of the same table or allowing non Joomla tools access to modify your Joomla database tables, you are way beyond what we would consider standard use of Joomla and modifying the database table to have a UNIQUE key should not be much of an added task.
If we see more users who have this exact issue we will consider how we can improve this feature in the future.
If you are already developing other extensions on top of the same table or allowing non Joomla tools access to modify your Joomla database tables, you are way beyond what we would consider standard use of Joomla and modifying the database table to have a UNIQUE key should not be much of an added task.
If we see more users who have this exact issue we will consider how we can improve this feature in the future.
Søren Beck Jensen
Founder, Component-Creator.com
The following user(s) said Thank You: Randy Tobias
Please 登录 或 注册一个帐号 to join the conversation.
Randy Tobias
New Member
Posts: 4
7 年 9 个月 前 #1483
由 Randy Tobias
Replied by Randy Tobias on topic Unique value field when you save the form
Thanks, this was the kind of answer that I was looking for. The reason why the approach was taken.
I certainly could manually update my table to add the uniqueness, but as we update the component (a lot now since we are still in development) and we develop on a test site before we move our finished products to a live site, we felt it would be safer at this point to add logic to check for and ensure uniqueness. Just too easy to miss altering the table at one crucial time and have things go wrong.
I would definitely be in favor of adding in the ability, maybe, to select an option on how uniqueness is enforced (through code or table structure) if this ends up being a reasonable possibility. Might even be interesting if you were able to provide a both option where both the binding method of the model, as well as altering the table are used.
Anyway, thank you very much for explaining the situation to me. I appreciate it.
I certainly could manually update my table to add the uniqueness, but as we update the component (a lot now since we are still in development) and we develop on a test site before we move our finished products to a live site, we felt it would be safer at this point to add logic to check for and ensure uniqueness. Just too easy to miss altering the table at one crucial time and have things go wrong.
I would definitely be in favor of adding in the ability, maybe, to select an option on how uniqueness is enforced (through code or table structure) if this ends up being a reasonable possibility. Might even be interesting if you were able to provide a both option where both the binding method of the model, as well as altering the table are used.
Anyway, thank you very much for explaining the situation to me. I appreciate it.
Please 登录 或 注册一个帐号 to join the conversation.
创建页面时间:0.098秒