Welcome Guest, Not a member yet? Register   Sign In
DataMapper (OverZealous Edition): include_related() + all_to_array()
#1

[eluser]tarciozemel[/eluser]
For those wich use the amazing DataMapper, can you use include_related() with all_to_array()? I'm trying to do this, but the all_to_array() only provides an empty array...

Code:
$empresas = new Empresa_model();
$empresas->where_related('cidade/uf', $uf)
     ->include_related('cidade', array('nome'))
     ->limit(1)
     ->get();
            
$array = array
    (
        'nome',
        'slug',
        'cidade'
    );

return $empresas->all_to_array($array);

When I do print_r($empresas->all_to_array($array)), I get:

Code:
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: datamapper/array.php
Line Number: 57


Array
(
    [0] => Array
        (
            [nome] => Foo
            [slug] => foo
            [cidade] => Array
                (
                )

        )

)

Can you help me? :-)




Theme © iAndrew 2016 - Forum software by © MyBB