Then you’re stuck with a large where clause if you need to search for multiple items…
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
November 30, 2011 3:43pm
Subscribe [100]#151 / Feb 06, 2012 3:40am
Then you’re stuck with a large where clause if you need to search for multiple items…
#152 / Feb 08, 2012 12:03pm
I’m speak english very bad, sorry.
I install DataMapper from the Sparks, and catch error like that http://ellislab.com/forums/viewreply/959058/
I have a fresh installation of CI, and put bootstrap into an index.php
Yes, when i install Datamapper without using Sparks, all working.
#153 / Feb 09, 2012 4:03am
hm… when i copy folder “sparks/DataMapper-ORM/1.8.2/third_party” to application folder, all working.
But it’s no Sparks way.
#154 / Feb 09, 2012 4:42am
Sounds like a path issue somewhere?
#155 / Feb 09, 2012 7:45am
Yes, bootstrapping from sparks enviropment not working. I wrote in index.php direct path то bootstrap.php, but it not work.
Help me, please, if you can.
#156 / Feb 13, 2012 9:40am
Hi, one quick question, is it now field “root_id” mandatory in tables for Nested Sets Extension, because I had a problem with dump_tree() method, until I returned value NULL for $ _rootfield in nestedsets.php
#157 / Feb 13, 2012 4:05pm
root_id is optional. It is needed when you store multiple trees in a single table, where this id acts as the tree selector.
#158 / Feb 13, 2012 5:36pm
and why doas not work for me, I used fresh copy of CI, Datamapper 1.8.2, and simplest example… and everything works except dump_tree and dump_dropdown
#159 / Feb 14, 2012 5:51am
Please define “not work”? What happens? Error messages?
#160 / Feb 14, 2012 9:44am
that is the problem, no errors, just an blank page, but when I change a variable “$_rootfield” to NULL (nestedsets.php) all starts to work
#161 / Feb 14, 2012 4:28pm
Well, this is exactly what you should do if your table doesn’t have a root column.
In the config, set ‘root’ to NULL.
(p.s. it should be NULL by default, as written in the manual. I don’t know why it is not so in the code, might be a leftover of some testing).
#162 / Feb 14, 2012 4:35pm
Sorry, this comes from codeigniter .com/forums/viewreply/979474/, I re posted because I’m using 1.8.2 instead of 1.8.0
Hi guys, I’m struggling to set up the validation rules to validate the related items on a specific object, ie: A user can have no more than 3 products related to it.
I believe DataMapper can check for this validation using _related_max_size rule in Related validation, but I can’t figure out how to use it on the $validation array in the model.
So far I’ve tried this in both my user and product models:
var $validation = array(
'product' => array(
'rules' => array('max_size' => 3)
)
);Can somebody show me an example on how to set up this at the model, controller and finally the view (specificly how to show the errors for this)?
Edit: What I mean is, a user has many products, and can create a certain amount of them, let’s say 3 products, when that amount is reached, the user can no longer create products, and this validation rule should not permit the user to create more products.
This would be the DB Schema:
Users table
------------------
id | username |
------------------Products table
------------------------
id | user_id | name |
------------------------Thanks!
#163 / Feb 14, 2012 6:08pm
I already answered there… 😉
Doesn’t really matter, the answer is the same for 1.8.0 and 1.8.2.
#164 / Feb 18, 2012 2:33am
I am not sure if this has been posted yet and I can’t access the issue tracker on bitbucket.
I just installed Datamapper 1.8.2 on an existing site. Previously I had to modify the core database files and remove the protected functions. Everything worked fine out of the box with the new bootstrap method except when using the count() function.
$m = new Message();
$new_messages_count = $m->where_related_user('id', $this->ion_auth->get_user()->id)->where_join_field('user', 'is_sender', 0)->where_join_field('user', 'is_deleted', 0)->where_join_field('user', 'is_read', 0)->count();This is the code I am using and it throws this error
PHP Fatal error: Cannot access protected property DM_DB_Driver::$_count_string in /application/libraries/datamapper.php on line 2588I have fixed this temporarily by changing:
protected $_count_string = 'SELECT COUNT(*) AS ';to
public $_count_string = 'SELECT COUNT(*) AS ';in system/database/drivers/mysql/mysql_driver.php
#165 / Feb 18, 2012 3:16am
Oops, indeed something I’ve missed.
That line should read:
$select = $this->dm_get('_count_string');