• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DataMapper: error with capitalization

Hi Wanwizard,

In DM 1.8.1, I'm receiving this error...

Quote:A PHP Error was encountered
Severity: Warning
Message: Illegal offset type in isset or empty
Filename: libraries/datamapper.php
Line Number: 4394

...due to the first letter of the $related_field value being capitalized.

For example, if $related_field = 'Sys_lookups' I get the error.

The error goes away when I insert this at line 4394:
$related_field = strtolower($related_field);

(I think the strtolower() may be better placed at line 4370.)

I've searched my code and don't find any models where the relationship names in $has_one or $has_many contain an uppercase first character.

This started after I started using the custom ITFK as shown below, however I have made many other changes to my code as well, so I don't know if this is the cause:

var $has_one = array(
  'sys_lookup' => array(
   'join_other_as' => 'account_type') //ITFK is account_type_id, not sys_lookup_id

I don't see this situation mentioned in the DM Change Log.

Can you provide any insight?

I don't have a 1.8.1. running here anymore, so it's difficult to debug.

This is a common error though if you pass an object somewhere where there is no object supported, only a string. Objects contain a __toString() magic that will return the model name ucfirst() when cast to string.

So are you passing a 'sys_lookup' object somewhere in your code where you should pass the string 'sys_lookup'?

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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