CodeIgniter Forums
DataMapper ORM v1.8.0 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: DataMapper ORM v1.8.0 (/showthread.php?tid=37531)



DataMapper ORM v1.8.0 - El Forum - 05-11-2011

[eluser]WanWizard[/eluser]
[quote author="Daniel H" date="1305125870"]I have just updated CI and Datamapper to the latest versions (1.8.0 datamapper, and the latest reactor build of CI) and I get this error when performing a simple save that used to work okay:

Code:
Fatal error: Cannot access protected property CI_Loader::$_ci_classes in /...path to.../application/libraries/Datamapper.php on line 1081

This is that line:

Code:
unset($CI->load->_ci_classes['form_validation']);

I can't spot what the problem is - any ideas?[/quote]
I assume this has to do with the process that's creating havok all over the place at the moment, where someone has decided to declare all class private properties (i.e. prefixed with an underscore) as protected, so it can't be accessed from outside the class anymore.

I understand why they would like this, but all 'system' extensions need access to the internals to work, so one by one they're going to top over.

Please report this at https://bitbucket.org/wanwizard/datamapper/issues so the issue stays on the radar until I have time to fix this.


DataMapper ORM v1.8.0 - El Forum - 05-11-2011

[eluser]WanWizard[/eluser]
[quote author="GeXus" date="1305140632"]It seems like it must be something with the Autoload? There is no User() function, except for what would be mapped to an object from the model[/quote]
Is the Datamapper library loaded (in the autoload config or before you access a model)? are your filenames lowercase?


DataMapper ORM v1.8.0 - El Forum - 05-11-2011

[eluser]Daniel H[/eluser]
[quote author="WanWizard" date="1305146928"]
I assume this has to do with the process that's creating havok all over the place at the moment, where someone has decided to declare all class private properties (i.e. prefixed with an underscore) as protected, so it can't be accessed from outside the class anymore.

I understand why they would like this, but all 'system' extensions need access to the internals to work, so one by one they're going to top over.

Please report this at https://bitbucket.org/wanwizard/datamapper/issues so the issue stays on the radar until I have time to fix this.[/quote]

Yes you're right - I have literally just discovered that people are complaining about this. I have overridden my Core loader turning these to public for the time being.


DataMapper ORM v1.8.0 - El Forum - 05-11-2011

[eluser]WanWizard[/eluser]
@gh0st,

Read the user guide: http://datamapper.wanwizard.eu/pages/update.html


DataMapper ORM v1.8.0 - El Forum - 05-11-2011

[eluser]gh0st[/eluser]
@WanWizard,

The page you reference does not state how to force validation on update statements.

Actually, it says:

Quote:Also, this method bypasses validation, and can also operate on in-table foreign keys, so please be aware of the risks.

I'm going to try and do a simple example outside of my main app with 1 required field and hopefully it'll work without any issue.

If you can clear up the mis-understanding of how to force validation on update, that'd be cool.

Thanks.


DataMapper ORM v1.8.0 - El Forum - 05-12-2011

[eluser]introvert[/eluser]
Hi,

I turned on CI error logging and I started getting "Could not find the language line """ error.
I put a backtrack on the language line() function and figured out it is being called by Datamapper class.

I occurs that each site request will write several of those error, all coming from Datamapper object.

Any idea what is going on?
Is this a bug?

Please note that I do not use language files with my project.

CI 2.0.3 + HMVC + Datamapper

Thanks for help


DataMapper ORM v1.8.0 - El Forum - 05-12-2011

[eluser]WanWizard[/eluser]
This is thanks to a combination of yourself (because there's a language string missing, or in your case an entire file) and the Reactor boys (who decided that every missing language line should be logged from now on).

All language strings used by Datamapper internally are included in the package (only for a few languages), if you use for example model validation, you need to define the language strings you use there.

If you don't intend to use language files (why not, then nothing useful will be printed?), prepare for a lot more errors. You might want to extend the language class, and remove the logging again.


DataMapper ORM v1.8.0 - El Forum - 05-13-2011

[eluser]introvert[/eluser]
I use model validation - 'unique' and 'required' params with my model.

Do they produce the error?

I don't have error messages defined for them, I thought that basic validation settings all have default error messages set.

So if I understand correctly, if I define the errors for those validation methods, the errors should go away. And the other option is to remove logging from the code.

I wonder why the error prints empty line string?

Thanks for help


DataMapper ORM v1.8.0 - El Forum - 05-13-2011

[eluser]WanWizard[/eluser]
Datamapper fetches language strings in the following situations:
- error message for a failed validation rules (for custom validation rules, see http://datamapper.wanwizard.eu/pages/validation.html#Error.Messages)
- for transation messages ( are defined in datamapper's language file )
- for errors related to saving relations ( are defined in datamapper's language file )
- for fieldname localisations ( needs {model}_{field} entries in the language file )

Unique is a method you have defined somewhere, and is therefore a custom validation rule. If it fails, it will produce an error and will fetch the message. Not sure why the key in the log would be empty.


DataMapper ORM v1.8.0 - El Forum - 05-13-2011

[eluser]WanWizard[/eluser]
Looking at the library code, the obvious candidate is fieldname localisation.

What have you configured in config/datamapper.php for the configuration key 'field_label_lang_format'? By default, it contains '${model}_${field}', if you have emptied this, a fieldname key for the language file can not be constructed, and a lookup will be done on an empty string.