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

[eluser]WanWizard[/eluser]
That is weird, _protect_identifiers is a method that is defined in CI's database driver, so it should exist.

What version of Pyro as you using?

[eluser]willaser[/eluser]
I started using the latest one, 2.1.4 I think. And now I am working with the develop branch 2.1. I "resolved" the issue using 'result_count()' instead 'count()', but now there is other problem with 'select_max()'. When I call this method, it searchs the max value in 'DMprefix_tablename.column' with the DM prefix included, but not with the PyroCMS prefix which is usually 'default_'. If I use the 'get()' method, DM includes the PyroCMS prefix without any error.

I tried DM as a library and as an spark, with both methods I get the same errors.

I will try to build it from the beginning again because I could have commited a mistake , but this was a recently built.

[eluser]WanWizard[/eluser]
Never tried DM in Pyro, and I'm very busy at the moment, but I can see if I can set something up.

[eluser]AAtticus[/eluser]
Hi WanWizard.

I'm stuck on a simple problem.

I have a COMPANY(id, name, address) table and a EMPLOYEE(id, firstname, lastname, company_id) table.

If I want to display all EMPLOYEES, no matter what company, i do:

Code:
$employees = new Employee();
$employees->get();
//

This works perfect but obviously in the view it shows the company_id integer instead of the name of the company

How would I populate a list of all employees and instead of the company_id showing, it shows the name of the relevant company that they work for...

[eluser]WanWizard[/eluser]
Try

Code:
$employees = new Employee();
$employees->include_related('company')->get();
echo $employees->company_name;

[eluser]AAtticus[/eluser]
Hi WanWizard,

This works but the problem is that I want to send it in an array to my view (I'm using Twiggy).

So when I do

Code:
$employees->include_related('company')->get();
$employees = $employees->all_to_array();

I lose the company related information

[eluser]AAtticus[/eluser]
Fixed it:


Code:
$employees = $employees->include_related('company', array('id', 'name'))->get()->all_to_array(array('id', 'firstname','lastname', 'mobile', 'telephone', 'email','company_id', 'company_name'));

$this->twiggy->set('employees', $employees , FALSE);

[eluser]insert_hilarity_here[/eluser]
Hi WanWizard

I know you have been maintaining Datamapper for nearly 2 years now, and I am wondering about the future of Datamapper. Currently I have a CI application with nearly 80 models using Datamapper and I am wondering about the Datamapper and CI 3.

Will Datamapper v1.8x be compatible with the next version of CI 3 because CI 3 is changing its active record class?

Is this the next version of https://github.com/WanWizard/Datamapper, and if so do you need help on it?

[eluser]WanWizard[/eluser]
[quote author="insert_hilarity_here" date="1346947123"]Hi WanWizard

I know you have been maintaining Datamapper for nearly 2 years now, and I am wondering about the future of Datamapper. Currently I have a CI application with nearly 80 models using Datamapper and I am wondering about the Datamapper and CI 3.

Will Datamapper v1.8x be compatible with the next version of CI 3 because CI 3 is changing its active record class?[/quote]
I will keep maintaining Datamapper as long as I have the time for it.

I can't say anything about CI 3 until it's released. I've given up trying to keep up with all the changes in the github repo, it was a nightmare. When CI 3 is announced feature complete, I'll have a look.

[quote author="insert_hilarity_here" date="1346947123"]
Is this the next version of https://github.com/WanWizard/Datamapper, and if so do you need help on it?[/quote]
It's a start. Some descisions have been made, like the use of Cabinet instead of CI's AR. I'm tired of coding workarounds for shortcomings in the native drivers.

Lots of stuff is still going to change, and I'm still struggling between writing a better ORM vs backward compatibility with DM 1.x. So don't expect anything soon, I'm very busy and I have to admit CI hasn't been very high on my list for quite some time now.

[eluser]PoetaWD[/eluser]
Hi Wan !

Thank you very much for keeping this alive !

I have a question,

I have two models, CARDS and VCARDS

Code:
$v = new Vcard();

$v->like('stNome', $card_name);
  
$v->where_related_card('nmTotalMana >', 4);

My problem is that I need to get only the Vcards that have a related card with the name LIKE something...

Code:
$v->like_related_card('name', 'giant');

Is it currently possible to do it ? Thank you very much !




Theme © iAndrew 2016 - Forum software by © MyBB