Welcome Guest, Not a member yet? Register   Sign In
DataMapper ORM v1.8.2

[eluser]Andrea Coronese[/eluser]
Hi, I've a problem with DataMapper-ORM spark version 1.8.2. It doesn't even seem to load at all. If I put the spark name in my $autoload["sparks"] array, my site crash with HTTP 500. No PHP logs at all in error log, but from CI logs it seems to stop at the CI Loader initialization, which makes me think that it is the spark messing everything up (if I remove the autoload, the CI installation works like a charm).

Please help Sad

[eluser]Andy78[/eluser]
Has anybody added Remember me auto login functionality to the example applications login script?

Iv been messing about trying to add it, I understand that its just a matter of setting a cookie with a hashed code in it then checking this against the stored users hashed code and if they match auto log them in. Just not sure of the best to fit it in with the existing logic?

[eluser]smi23[/eluser]
Hello.
I think I've found a bug with where_between_related():
If the query like:
Code:
$obj->select('fields')->include_related('model',array('fields'))
   ->group_start()->where_related('model','deleted',0)->where_between_related('other_model','time',$from,$to)->group_end()
   ->distinct()->get_paged(1,10);
it returns an error in SQL syntax. That is the where part: (I had a table prefix)
Code:
WHERE `model`.`deleted` = 0 AND `ci_`other_model`.`time` BETWEEN 10 AND 16
so the error is in constructing the table name (`ci_`other_model`).

Line 3659 (datamapper.php), function _where_between()
Code:
$this->db->dm_call_method('_where', "`$key` ".($not?"NOT ":"")."BETWEEN ".$value1." AND ".$value2, NULL, $type, NULL);
I've replaced that with
Code:
$this->db->dm_call_method('_where', $this->add_table_name($key) . " ".($not?"NOT ":"")."BETWEEN ".$value1." AND ".$value2, NULL, $type, NULL);
And now it works fine.

If it the problem in my query hope to see the solution.

[eluser]WanWizard[/eluser]
@Andrea Coronese,

Have you read the documentation? And if so, did you make the modifications to your index.php?

[eluser]Andrea Coronese[/eluser]
@WanWizard yes I did, even thou I'm using the spark package. Didn't work Sad

[eluser]WanWizard[/eluser]
@smi23,

Thanks for spotting that, I'll change that for the next version.

[eluser]coldscooter[/eluser]
If i've set up a many to many relationship between my users table and and languages table.

Am i able to add entries to the relational table (languages_users) through the User object?

[eluser]smi23[/eluser]
Hello again!
I think I've found another bug, but co-workers says that it shouldn't.
Function include_related_count().
Code:
$customers = new Clinic_customer();
$customers->include_related('clinic',array('name'))->include_related_count('clinic_customer_journal')
  ->where_related('clinic','deleted',0)->get_paged(1,10);
It returns an error with Unknown column 'clinic_customers_subquery.id':
Code:
SELECT `ci_clinic_customers`.*, `clinics`.`name` AS clinic_name,
(SELECT COUNT(*) AS count FROM (`ci_clinic_customer_journals`) LEFT OUTER JOIN `ci_clinic_customers` clinic_customers
  ON `clinic_customers_subquery`.`id` = `ci_clinic_customer_journals`.`clinic_customer_id`
  WHERE `clinic_customers_subquery`.id = `clinic_customers`.`id`) AS clinic_customer_journal_count
FROM ....
And I found in function _parse_subquery_object() // line 3054, that it replace clinic_customers.id with clinic_customer_subquery.id , but the alias for table ci_clinic_customer it leaves without changing (clinic_customers).
Models should be fine (I worked with them a lot).

Please, help me to resolve this.

[eluser]WanWizard[/eluser]
[quote author="coldscooter" date="1337896411"]If i've set up a many to many relationship between my users table and and languages table.

Am i able to add entries to the relational table (languages_users) through the User object? [/quote]
Entries in the relational table are links defining the relation. They will be created automatically when you save a relation.

[eluser]coldscooter[/eluser]
Is anyone able to provide a basic example of a join using DataMapper? I don't see any clear example of it in the manual.




Theme © iAndrew 2016 - Forum software by © MyBB