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

[eluser]Jacob F.[/eluser]
Oh, that makes sense then.

I was able to work it out tho--I ended up assimilating a fair amount of logic from _unique() since I needed some of the pieces from it to do other things:

Code:
function _unique_not_deleted($field) {

if ( ! empty($this->{$field}) ) {
  $query = $this->db->get_where($this->table, array($field => $this->{$field}));
  $num_rows = $query->num_rows();

  if ( $num_rows > 0 ) {
   $rows = $query->result_array();
   foreach ( $rows as $row ) {

    //If unique value does not belong to this object.
    if ( $this->id != $row['id'] ) {//It is not unique.
     $result = ( $row['deleted'] )?
      TRUE ://Ignore row if deleted.
      'A user with that %s already exists.' ;
     if ( $result!==TRUE ) { break; }//Just need one
    }//fi $this->id != $row->id

   }//foreach
  }//fi query->num_rows > 0

}//fi !empty

return ( isset($result) )? $result : TRUE;//No matches found |=> unique.

}//_unique_not_deleted()

[eluser]PhilippMikael[/eluser]
I think I've found a bug in this version. When I was trying to use DataMapper's rowindex extension (row_index), an undefined method error (DMZ_RowIndex::get_rowindices()) occured in datamapper\rowindex.php on line 37. I guess instead of
Code:
$result = $this->get_rowindices($object, $id, $leave_select, $distinct_on);
there should be
Code:
$result = $this->row_indices($object, $id, $leave_select, $distinct_on);
After replacing this line, the method row_index works fine.

Although you might not be working on this version anymore, it might be helpful for others.

Btw: I really appreciate your work and I'm looking forward to the next release of DataMapper. And nice to see that you moved your project to github. Thank you very much.

[eluser]WanWizard[/eluser]
Can you create an issue for this on bitbucket (not on github please, that's a different version) so I can get this fixed?

[eluser]PhilippMikael[/eluser]
[quote author="WanWizard" date="1343938718"]Can you create an issue for this on bitbucket (not on github please, that's a different version) so I can get this fixed?[/quote]

OK, done.

[eluser]Mark Price[/eluser]
The "model_path" config parameter is not being processed when the production_cache is enabled. Model paths are added to the class variable $model_paths in "function _relationship(...)" but this function is not called if the model has already been cached.

Everything was working great with production_cache disabled but when I enable it I get the error class not found.

[eluser]WanWizard[/eluser]
Well spotted, and thanks for reporting. Here you go:

https://bitbucket.org/wanwizard/datamapp...c57ef2c671

[eluser]Mark Price[/eluser]
Thank you for fixing the cache model_path problem.

I updated with the latest revisions from the repository but I get:
Code:
Fatal error: Call to undefined method MX_Lang::dm_line() in /public_html/application/libraries/datamapper.php on line 6001

I changed
Code:
class_exists('MX_Lang', false)  and $name = 'MX_Lang';
to
Code:
class_exists('MX_Lang')  and $name = 'MX_Lang';
in the /application/third_party/datamapper/system/Lang.php and that fixed it.

[eluser]WanWizard[/eluser]
Thanks for the feedback. I've never used MX, but I try to support it as many people do.

I find this a bit of an odd fix.

The purpose of this line is to see if MX_Lang is loaded. The "false" just makes sure the DM autoloader isn't triggered. CI itself doesn't have an autoloader, so either MX is loaded before Datamapper, and then this line works, or MX is loaded after Datamapper, which will never work.

My guess is that you haven't loaded MX before you load Datamapper, and that removing the parameter will activate the DM autoloader, which will now load the MX_Lang library for you (as it only filters CI and EE libraries).

So the proper solution is: make sure you have MX active before you load Datamapper.

[eluser]rick20[/eluser]
hi all, recently I just started to use WanWizard datamapper in one of my projects.
And I have a very basic issue that I couldnt solve it by googling.
I have a table with a nullable INT column.
How do I use datamapper to do something like
Code:
WHERE point IS NOT NULL"
?
I read and read again the documentation, but still doesnt have any answer Sad
Am I missed a section in the documentation?
Anyone can help?
Thanks alot Smile

[eluser]WanWizard[/eluser]
Datamappers where() method uses CI's active record implementation, so anything that works there also works in DM.

The suggested answer for CI is
Code:
$this->db->where('point !=', null);




Theme © iAndrew 2016 - Forum software by © MyBB