• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DataMapper ORM v1.8.0

#41
[eluser]Haqqi[/eluser]
[quote author="WanWizard" date="1295912180"]@Haqqi,

A solution has been implemented in latest version on BitBucket.

This allows you to specify the path in the models advanced relationship definition, or manually (for example in the controller constructor) using the static method Datamapper::add_model_path().[/quote]

Thank you. I will use it immediately in my project.

#42
[eluser]dejavu[/eluser]
I'm saving an object in DataMapper, and checking the results.

save() is returning an unexpected result - NULL instead of true, but the record STILL shows up in the db. Here's the code.

Code:
$person = new Person();
  $person->load_extension('array');
  $person->from_array($_POST, $contact_fields);

  $save_result = $person->save();

  if($save_result == true) {  
    foreach($contact_fields as $field) {
      unset($_POST[$field]);
    }
  }
  elseif ($save_result === false) {
    echo "False\n";
  }
  elseif ($save_result === NULL) {
    echo "NULL\n";
  }
NULL is what shows up.
Any ideas? Thanks!

#43
[eluser]ipsod[/eluser]
Using the built-in errors, I get this:
Unable to access an error message corresponding to your rule name: required.
Unable to access an error message corresponding to your rule name: numeric.


...?

#44
[eluser]Lucas Alves[/eluser]
Hi...

I'd like to know how could I use class name suffix. For example, my models are usin "_m" suffix, like "user_m".

I use datamapper version 1.7.1 and want to update to 1.8

On this old version I made some black magic to make this work, but I'm fighting with bugs due to my bad magic.

Thanks.

#45
[eluser]Robert Liljedahl[/eluser]
Good day people.
First: Thanks alot for a great lib.
I noticed the extension Nestedsets and was hoping it would save me some headache.
I am creating a multisite cms, that uses only one db, that contains of a lot of different modules (using Modular Extensions - which now plays nicely with DataMapper).

This is how I'm thinking my tree:
id
site_id
module_id
item_id
left_id
right_id

site_id = the id of the site currently being accessed.
module_id = the id of the module, could for instance reefer to the module "pages".
item_id = the id of a module post, could be one specific page in the "pages" module.

I guess if I didn't have multi site system I would use "value" as my module_id to separate the different trees?
Would it be possible for me to use the extension for this? Or am taking the wrong approach to this problem?

Another thing:
When I try in my model try to declare the $nestedsets array do set options, they don't have any effect.

Model Code:
Code:
<?php
class Tree extends DataMapper {
    
    var $nestedsets = array(
        'left' => 'lft',
        'right' => 'rgt'
    );
    
    var $extensions = array("nestedsets");
    var $has_many = array('site', 'module');
    
    function __construct($id = NULL)
    {
        parent::__construct($id);
    }
    
}

Thanks alot.
/Robert

#46
[eluser]Burton Kent[/eluser]
By the way, the search at http://datamapper.wanwizard.eu/ seems to point to the old, temporary site set up at http://datamapper.excitecms.org. Can this be fixed, please?

#47
[eluser]ipsod[/eluser]
Ok, found my answer in the lang file. What an awesome way to handle error messages. (first time I've messed with lang files)

#48
[eluser]ipsod[/eluser]
Hi. I've got a new question.

I'm trying to set up my relations like this:

Transactions have two Accounts - to and from. Accounts, though, I don't want to have Incomes and Expenses separately, just Transactions, so that I can do $a->transactions->get_iterated(); and have all the transactions ordered by date, but I can't seem to get them set up this way.

I'm working around this by setting up the multiple relations as described in the manual and doing $t->where('to', $account_id)->or_where('from', $account_id), but would prefer the other method, if possible.

#49
[eluser]WanWizard[/eluser]
@dejavu:

The save() method uses this to return the value:
Code:
// If no failure was recorded, return TRUE
return ( ! empty($result) && ! in_array(FALSE, $result));
which imho can never return NULL, it will always return a boolean.

There are no other exits in that method other than this return statement. What exactly have you been testing?

#50
[eluser]WanWizard[/eluser]
@ipsod:

you get those error messages if the language file could not be loaded, or if the language file loaded does not contain the required language strings.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.