Beispiel #1
0
 private function del($args)
 {
     $p = ServiceRenderJson::newInstance();
     $u = ServiceAuth::getInstance()->getUser();
     $i = $u->getId();
     if ($v = $this->getQueryNext()) {
         if (!($o = $u->getPhoto($v))) {
             $p->setData('success', false)->setData('message', 'Cette photo n\'existe pas !');
         } elseif ($o->getUser_id() != $i) {
             $p->setData('success', false)->setData('message', 'Cette photo n\'est pas la votre !');
         } else {
             if (!ServiceDb::getInstance()->delete($o)) {
                 $p->setData('message', 'L\'opération a échoué !');
             } else {
                 $p->setData('success', true)->setData('message', 'La photo a bien été supprimée');
                 $u->delPhoto($o);
                 $f = '../public/uploads/' . $o->getId();
                 //.'.'.$ext;
                 if (@unlink($f)) {
                     ServiceDb::getInstance()->persist(ModelAction::newInstance()->setUser_id($i)->setType('delete')->setObject('photo')->setValue($o->getId())->setWhen());
                 } else {
                     $p->setData('success', false)->setData('message', 'Erreur lors de la suppression de l\'image');
                 }
             }
         }
     } else {
         $p->setData('success', false);
     }
     $p->render();
 }
Beispiel #2
0
 public function execute($args = null)
 {
     $p = ServiceRenderJson::newInstance();
     if (isset($_POST['id'], $_POST['type'], $_POST['action'])) {
         if (!($u = CollectionUser::newInstance()->find($_POST['id']))) {
             $p->setData('success', false)->setData('message', 'Membre inconnu');
         } else {
             $c = ($_POST['action'] == 'add' ? 'enable' : 'disable') . 'Type';
             $r = ServiceAuth::getInstance()->getUser()->getUser_has_user($u);
             $r->{$c}($_POST['type']);
             if (ServiceDb::getInstance()->persist($r)) {
                 $p->setData('success', true)->setData('message', 'La relation a bien été ' . ($_POST['action'] == 'add' ? 'ajoutée' : 'supprimée'));
                 ServiceDb::getInstance()->persist(ModelAction::newInstance()->setUser_id(ServiceAuth::getInstance()->getUser()->getId())->setObject('relation')->setValue($u->getLogin() . ' (' . ModelUser_has_user::$shortNames[$_POST['type']] . ')')->setType($_POST['action'] == 'add' ? 'create' : 'delete')->setWhen());
                 if ($r->getType() == 0) {
                     ServiceAuth::getInstance()->getUser()->delUser_has_user($r);
                     ServiceDb::getInstance()->delete($r);
                 } else {
                     ServiceAuth::getInstance()->getUser()->addUser_has_user($r);
                 }
             } else {
                 $p->setData('message', 'L\'opération a échoué !');
             }
         }
     } else {
         $p->setData('success', false);
     }
     $p->render();
 }
Beispiel #3
0
    public function findByWithUser($names, $ids)
    {
        if (!is_array($ids)) {
            $ids = array($ids);
        }
        if (!is_array($names)) {
            $names = array($names);
        }
        $c = static::getModelName();
        $sth = ServiceDb::getInstance()->prepare('
				select `' . static::getTableName() . '`.*, `user`.*
				from `' . static::getTableName() . '`
				left join `user` on `user`.`id`=`' . static::getTableName() . '`.`user_id`
				where `' . implode('`=? and `', $names) . '`=?');
        $sth->execute($ids);
        $arr = array();
        foreach ($sth->fetchAll() as $data) {
            if ($data['id'] == ServiceAuth::getInstance()->getUser()->getId()) {
                continue;
            }
            $a = new ModelUser();
            $a->hydrate($data);
            $b = new $c();
            $b->hydrate($data);
            $a->setProfile($b);
            $arr[] = $a;
        }
        return $arr;
    }
Beispiel #4
0
 public function execute($args = null)
 {
     if (!empty($_POST)) {
         $_POST['id'] = null;
         $_POST['hash'] = ServiceAuth::createHash($_POST['pass1']);
         $_POST['inBounds'] = 0;
         $_POST['outBounds'] = 0;
         $u = ModelUser::newInstance()->hydrate($_POST);
         $p = ModelProfile::newInstance();
         if ($_POST['pass1'] != $_POST['pass2']) {
             ServiceMessage::getInstance()->addMessage('Les mots de passes ne correspondent pas', 'error');
         } elseif (CollectionUser::newInstance()->findBy('login', $_POST['login'])) {
             ServiceMessage::getInstance()->addMessage('Ce login est déjà utilisé', 'error');
         } else {
             if (ServiceDb::getInstance()->persist($u)) {
                 if ($i = ServiceDb::getInstance()->lastInsertId()) {
                     if (ServiceDb::getInstance()->persist($p->hydrate(array('user_id' => $i)))) {
                         ServiceMessage::getInstance()->addMessage('Votre compte a bien été créé', 'success');
                         ServiceDb::getInstance()->persist(ModelAction::newInstance()->setUser_id($i)->setType('create')->setObject('profile')->setWhen());
                         return header('Location: /logout/quiet');
                     } else {
                         ServiceDb::getInstance()->delete($u);
                         ServiceMessage::getInstance()->addMessage('Une erreur est survenue #2', 'error');
                     }
                 } else {
                     ServiceMessage::getInstance()->addMessage('Une erreur est survenue #1', 'error');
                 }
             }
         }
     }
     ServiceRenderHtml::newInstance()->load('subscribe')->setData('hideNavigation', true)->render();
 }
Beispiel #5
0
 private function updateV($args)
 {
     $p = ServiceRenderJson::newInstance();
     $pro = ServiceAuth::getInstance()->getUser()->getProfile();
     if (isset($_POST['id'], $_POST['value'])) {
         if (!($u = $pro->getParameter($_POST['id']))) {
             $p->setData('success', false)->setData('message', 'Paramètre inconnu');
         } else {
             if (!ModelParameter::isValidVisibility($_POST['value'])) {
                 $p->setData('success', false)->setData('message', 'Valeur incorrecte');
             } else {
                 $u->setVisibility($_POST['value']);
                 // we persist the Profile, not the Parameter ! Be careful
                 if (ServiceDb::getInstance()->persist($pro)) {
                     $p->setData('success', true)->setData('message', 'La visibilité du paramètre a bien été modifiée');
                     ServiceDb::getInstance()->persist(ModelAction::newInstance()->setUser_id(ServiceAuth::getInstance()->getUser()->getId())->setType('update')->setObject('parameter visibility')->setValue($_POST['id'])->setWhen());
                 } else {
                     $p->setData('message', 'L\'opération a échoué !');
                 }
             }
         }
     } else {
         $p->setData('success', false);
     }
     $p->render();
 }
Beispiel #6
0
    public function delete(Persistable $instance)
    {
        $t = strtolower(str_replace('Model', '', get_class($instance)));
        $sth = ServiceDb::getInstance()->prepare('
				delete from `' . $t . '`
				where `' . implode('`=? and `', $instance::getPersistentId()) . '`=?
				limit 1');
        foreach ($instance::getPersistentId() as $V) {
            $c = getGetter($V);
            $v[] = $instance->{$c}();
        }
        $a = $sth->execute($v);
        return $a;
    }
Beispiel #7
0
    public function findAllWithReputation()
    {
        $sth = ServiceDb::getInstance()->prepare('
				select `user`.*, (`inBounds`/(`inBounds`+`outBounds`)) `reputation`
				from `user`
				order by `reputation` desc, `inBounds` desc');
        $sth->execute();
        $arr = array();
        foreach ($sth->fetchAll() as $data) {
            $a = new ModelUser();
            $a->hydrate($data);
            $arr[] = $a;
        }
        return $arr;
    }
Beispiel #8
0
    public function findAllCoworkers()
    {
        $k = '';
        foreach (array_keys(ModelUser::newInstance()->getPersistentData()) as $v) {
            $k .= "`user1`.`{$v}` `a__{$v}`, `user2`.`{$v}` `b__{$v}`,";
        }
        $sth = ServiceDb::getInstance()->prepare('
				select `user_has_user`.*,
				' . $k . '
				`user1`.`id` `a__id`,
				`user2`.`id` `b__id`
				from `user_has_user`
				left join `user` `user1` on `user1`.`id`=`user_has_user`.`user_id1`
				left join `user` `user2` on `user2`.`id`=`user_has_user`.`user_id2`
				where (`user_has_user`.`type` & ' . ModelUser_has_user::WORK . ' )
				and exists (
					select 1
					from `user_has_user` `foo`
					where `user_has_user`.`user_id2`=`foo`.`user_id1`
					and (`foo`.`type` & ' . ModelUser_has_user::WORK . ' )
				)');
        $sth->execute();
        $pairs = array();
        $arr = array();
        foreach ($sth->fetchAll() as $data) {
            $datax = array();
            // FIXME : find another way to avoir doublons
            if (in_array($data['a__id'] . '.' . $data['b__id'], $pairs) || in_array($data['b__id'] . '.' . $data['a__id'], $pairs)) {
                continue;
            }
            $pairs[] = $data['a__id'] . '.' . $data['b__id'];
            $a = ModelUser_has_user::newInstance()->hydrate($data);
            foreach ($data as $k => $v) {
                if (strpos($k, 'a__') === 0) {
                    $datax[str_replace('a__', '', $k)] = $v;
                }
            }
            $a->setUser1(ModelUser::newInstance()->hydrate($datax));
            foreach ($data as $k => $v) {
                if (strpos($k, 'b__') === 0) {
                    $datax[str_replace('b__', '', $k)] = $v;
                }
            }
            $a->setUser2(ModelUser::newInstance()->hydrate($datax));
            $arr[] = $a;
        }
        return $arr;
    }
Beispiel #9
0
    public function countDesc()
    {
        $sth = ServiceDb::getInstance()->prepare('
				select `action`.*
				,`user`.*
				,count(*) as `nb`
				from `action`
				left join `user`
				on `user`.`id`=`action`.`user_id`
				group by `action`.`user_id`
				order by `nb` desc');
        $sth->execute();
        $arr = array();
        foreach ($sth->fetchAll() as $data) {
            $a = new ModelUser();
            $a->hydrate($data);
            $b = new ModelAction();
            $b->hydrate($data);
            $b->setUser($a);
            $arr[] = array($b, $data['nb']);
        }
        return $arr;
    }
Beispiel #10
0
 private function del($args)
 {
     $p = ServiceRenderJson::newInstance();
     $u = ServiceAuth::getInstance()->getUser();
     $i = $u->getId();
     if ($v = $this->getQueryNext()) {
         if (!($o = $u->getSkill($v))) {
             $p->setData('success', false)->setData('message', 'Vous n\'avez pas cette compétence #1');
         } elseif ($o->getUser_id() != $u->getId()) {
             $p->setData('success', false)->setData('message', 'Vous n\'avez pas cette compétence #2');
         } else {
             if (!ServiceDb::getInstance()->delete($o)) {
                 $p->setData('message', 'L\'opération a échoué !');
             } else {
                 $p->setData('success', true)->setData('message', 'La compétence a bien été supprimée');
                 $u->delSkill($o);
                 ServiceDb::getInstance()->persist(ModelAction::newInstance()->setUser_id($i)->setType('delete')->setObject('skill')->setValue($o->getName())->setWhen());
             }
         }
     } else {
         $p->setData('success', false);
     }
     $p->render();
 }
Beispiel #11
0
<!DOCTYPE html>
<html lang="pt-br">
    <head>
        <meta charset="UTF-8">
        <title></title>
        <link rel="stylesheet" href="css/main_style.css" />
    </head>
    <body>
        <?php 
require_once 'interface/Entidade.interface.php';
require_once 'classes/Usuario.class.php';
require_once 'classes/ServiceDb.class.php';
require_once "conexao.php";
$pdo = Conectar();
$usuario = new Usuario();
$processo = new ServiceDb($pdo, $usuario);
$id = filter_input(INPUT_GET, "id") ? filter_input(INPUT_GET, "id") : NULL;
$acao = filter_input(INPUT_GET, "acao") ? filter_input(INPUT_GET, "acao") : NULL;
switch ($acao) {
    case "editar_usuario":
        $ident = "&id=" . $id;
        $login = $processo->Find("id=:id", $id)["login"];
        $senha = $processo->Find("id=:id", $id)["senha"];
        $bt = "EDITAR USUÁRIO";
        $acao = "Editar";
        break;
    case "excluir_usuario":
        $ident = "&id=" . $id;
        $login = $processo->Find("id=:id", $id)["login"];
        $senha = $processo->Find("id=:id", $id)["senha"];
        $bt = "DESEJA MESMO EXCLUIR ESTE USUÁRIO?";
Beispiel #12
0
<h1>LISTA DE USUÁRIOS</h1>
<?php 
$id = filter_input(INPUT_GET, "id") ? filter_input(INPUT_GET, "id") : NULL;
$acao = filter_input(INPUT_GET, "acao") ? filter_input(INPUT_GET, "acao") : NULL;
require_once 'interface/Entidade.interface.php';
require_once 'classes/ServiceDb.class.php';
require_once 'classes/Usuario.class.php';
require_once 'classes/Update.class.php';
require_once "conexao.php";
$pdo = Conectar();
$usuario = new Usuario();
$exec = new ServiceDb($pdo, $usuario);
foreach ($exec->Listar("id ASC") as $listar) {
    echo $listar->login . " - <a href='index.php?id=" . $listar->id . "&sessao=4&acao=editar_usuario'> Editar</a> | <a href='index.php?id=" . $listar->id . "&acao=excluir_usuario&sessao=4'> Excluir </a> <br />";
}
Beispiel #13
0
        $lb2 = "nota";
        $bt = "CADASTRAR ALUNO ";
        $acao = "cad_aluno";
        break;
    case 4:
        $ident = "";
        $campo1 = "value = \"\" name = 'login' id = 'login'";
        $campo2 = "value = \"\" name = 'senha' id = 'senha'";
        $lb1 = "login";
        $lb2 = "senha";
        $bt = "CADASTRAR USUÁRIO ";
        $acao = "cad_user";
        break;
    case 7:
        $usuario = new Usuario();
        $processo = new ServiceDb($pdo, $usuario);
        $id = filter_input(INPUT_GET, "id") ? filter_input(INPUT_GET, "id") : NULL;
        $ident = "&id=" . $id;
        $campo1 = "value = '" . $processo->Find($id)["login"] . "' name = 'login' id = 'login'";
        $campo2 = "value = '" . $processo->Find($id)["senha"] . "' name = 'senha' id = 'senha'";
        $lb1 = "login";
        $lb2 = "senha";
        $bt = "EDITAR USUÁRIO";
        $acao = "editar";
        break;
}
?>
        <form method="post" action="executar.php?acao=<?php 
echo $acao . $ident;
?>
">
<?php

require_once 'EntidadeInterface.php';
require_once 'Cliente.php';
require_once 'ServiceDb.php';
try {
    $conexao = new \PDO("mysql:host=localhost;dbname=pdo", "root", "root");
} catch (\PDOException $e) {
    die("Não foi possível estabelecer a conexão com o banco de dados. Erro código:" . $e->getCode() . ": " . $e->getMessage());
}
$cliente = new Cliente();
$cliente->setNome("Maria")->setEmail("*****@*****.**");
$serviceDb = new ServiceDb($conexao, $cliente);
foreach ($serviceDb->listar() as $c) {
    echo $c['nome'] . "<br>";
}
Beispiel #15
0
<h1>LISTA DE ALUNOS</h1>
<?php 
$busca = filter_input(INPUT_GET, "busca_aluno") ? filter_input(INPUT_GET, "busca_aluno") : NULL;
$id = filter_input(INPUT_GET, "id") ? filter_input(INPUT_GET, "id") : NULL;
$acao = filter_input(INPUT_GET, "acao") ? filter_input(INPUT_GET, "acao") : NULL;
require_once 'interface/Entidade.interface.php';
require_once 'classes/ServiceDb.class.php';
require_once 'classes/Aluno.class.php';
require_once 'classes/Update.class.php';
require_once "conexao.php";
$pdo = Conectar();
$aluno = new Aluno();
$exec = new ServiceDb($pdo, $aluno);
if (!isset($busca)) {
    foreach ($exec->Listar("id ASC") as $listar) {
        echo $listar->nome . ", nota: " . $listar->nota . "   - <a href='index.php?id=" . $listar->id . "&sessao=3&acao=editar_aluno'> Editar</a> | <a href='index.php?id=" . $listar->id . "&acao=excluir_aluno&sessao=3'> Excluir </a> <br />";
    }
} else {
    $atributos = $exec->Find("nome=:nome", $busca);
    echo $atributos["nome"] . ", nota: " . $atributos["nota"] . "   - <a href='index.php?id=" . $atributos["id"] . "&sessao=3&acao=editar_aluno'> Editar</a> | <a href='index.php?id=" . $atributos["id"] . "&acao=excluir_aluno&sessao=3'> Excluir </a> <br />";
}
?>
<br /><br />
<form method="get" action="#">
    <label for="busca_aluno">Busca Aluno</label>
    <input type="text" name="busca_aluno" id="busca_aluno"/> 
    <input type="submit" value="buscar" />
</form>
<br /><br />
Beispiel #16
0
        <link rel="stylesheet" href="css/main_style.css" />
    </head>
    <body>
        <div class="container clearfix">
            <?php 
include_once 'header.php';
?>
            <section class="content">
                <?php 
require_once 'interface/Entidade.interface.php';
require_once 'classes/Aluno.class.php';
require_once 'classes/ServiceDb.class.php';
require_once "conexao.php";
$pdo = Conectar();
$aluno = new Aluno();
$processo = new ServiceDb($pdo, $aluno);
if (filter_input(INPUT_GET, "sessao")) {
    $pg = filter_input(INPUT_GET, "sessao");
    switch ($pg) {
        case "1":
            include "home.php";
            break;
        case "2":
            $processo->Deletar(filter_input(INPUT_GET, "id"));
            header("location:index.php");
            break;
        case "4":
            include "cadastro.php";
            break;
    }
} else {
Beispiel #17
0
        $nota = filter_input(INPUT_POST, "nota") ? filter_input(INPUT_POST, "nota") : NULL;
        $obj->setNome($nome);
        $obj->setNota($nota);
        $dds = ["nome" => $obj->getNome(), "nota" => $obj->getNota()];
        $dados = $obj->setDados($dds);
        $exec = new ServiceDb($pdo, $obj);
        $sessao = 1;
        break;
    case "Usuario":
        $login = filter_input(INPUT_POST, "login") ? filter_input(INPUT_POST, "login") : NULL;
        $senha = filter_input(INPUT_POST, "senha") ? filter_input(INPUT_POST, "senha") : NULL;
        $obj->setLogin($login);
        $obj->setSenha(md5($senha));
        $dds = ["login" => $obj->getLogin(), "senha" => $obj->getSenha()];
        $dados = $obj->setDados($dds);
        $exec = new ServiceDb($pdo, $obj);
        $sessao = 2;
        break;
}
switch ($acao) {
    case "Cadastrar":
        $exec->Inserir($obj->getDados());
        break;
    case "Editar":
        $exec->Alterar($id, $obj->getDados());
        break;
    case "Excluir":
        $exec->Deletar($id);
        break;
}
header("location:index.php?sessao=" . $sessao);
Beispiel #18
0
$id = filter_input(INPUT_GET, "id") ? filter_input(INPUT_GET, "id") : NULL;
$acao = filter_input(INPUT_GET, "acao") ? filter_input(INPUT_GET, "acao") : NULL;
$nome = filter_input(INPUT_POST, "nome") ? filter_input(INPUT_POST, "nome") : NULL;
$nota = filter_input(INPUT_POST, "nota") ? filter_input(INPUT_POST, "nota") : NULL;
require_once 'interface/Entidade.interface.php';
require_once 'classes/ServiceDb.class.php';
require_once 'classes/Aluno.class.php';
require_once "conexao.php";
$pdo = Conectar();
$aluno = new Aluno();
$aluno->setId($id);
$aluno->setTable("alunos");
$aluno->setNome($nome);
$aluno->setNota($nota);
$dds = ["nome" => $aluno->getNome(), "nota" => $aluno->getNota()];
$aluno->setDados($dds);
$aluno->setTermos("WHERE id = {$id}");
$exec = new ServiceDb($pdo, $aluno);
switch ($acao) {
    case "cadastrar":
        $exec->Inserir();
        break;
    case "editar":
        $exec->Alterar();
        break;
}
header("location:index.php");
?>
    </body>
</html>
Beispiel #19
0
<html lang="pt-br">
    <head>
        <meta charset="UTF-8">
        <title></title>
        <link rel="stylesheet" href="css/main_style.css" />
    </head>
    <body>
        <?php 
require_once 'interface/Entidade.interface.php';
require_once 'classes/Aluno.class.php';
require_once 'classes/ServiceDb.class.php';
require_once 'classes/ServiceDb.class.php';
require_once "conexao.php";
$pdo = Conectar();
$aluno = new Aluno();
$processo = new ServiceDb($pdo, $aluno);
$id = filter_input(INPUT_GET, "id") ? filter_input(INPUT_GET, "id") : NULL;
$acao = filter_input(INPUT_GET, "acao") ? filter_input(INPUT_GET, "acao") : NULL;
switch ($acao) {
    case "editar_aluno":
        $ident = "&id=" . $id;
        $nome = $processo->Find("id=:id", $id)["nome"];
        $nota = $processo->Find("id=:id", $id)["nota"];
        $bt = "EDITAR ALUNO";
        $acao = "Editar";
        break;
    case "excluir_aluno":
        $ident = "&id=" . $id;
        $nome = $processo->Find("id=:id", $id)["nome"];
        $nota = $processo->Find("id=:id", $id)["nota"];
        $bt = "DESEJA MESMO EXCLUIR ESTE ALUNO?";
Beispiel #20
0
<html lang="pt-br">
    <head>
        <meta charset="UTF-8">
        <title></title>
        <link rel="stylesheet" href="css/main_style.css" />
    </head>
    <body>
        <?php 
require_once 'interface/Entidade.interface.php';
require_once 'classes/Aluno.class.php';
require_once 'classes/ServiceDb.class.php';
require_once 'classes/ServiceDb.class.php';
require_once "conexao.php";
$pdo = Conectar();
$aluno = new Aluno();
$processo = new ServiceDb($pdo, $aluno);
$acao = filter_input(INPUT_GET, "acao") ? filter_input(INPUT_GET, "acao") : NULL;
switch ($acao) {
    case "editar":
        $id = filter_input(INPUT_GET, "id") ? filter_input(INPUT_GET, "id") : NULL;
        $ident = "&id=" . $id;
        $nome = $processo->Find($id)["nome"];
        $nota = $processo->Find($id)["nota"];
        $bt = "EDITAR";
        break;
    case NULL:
        $bt = "CADASTRAR";
        $ident = "";
        $nome = "";
        $nota = "";
        $acao = "cadastrar";
<?php

require_once "EntidadeInterface.php";
require_once "Cliente.php";
require_once "ServiceDb.php";
try {
    $conexao = new \PDO("mysql:host=localhost;dbname=pdo", "root", "root");
} catch (\PDOException $e) {
    die("Não foi possível estabelecer a conexão com o banco de dados ");
}
//$cliente = new Cliente($conexao);
//$cliente->setNome("Rodrigo")
//        ->setEmail("*****@*****.**")
//;
//$cliente->setId(1)
//    ->setNome("Rodrigo Angelo")
//    ->setEmail("*****@*****.**")
//;
//$resultado = $cliente->find(2);
//
//echo $resultado['nome'];
//foreach($cliente->listar("id desc") as $c) {
//    echo $c['nome'] . '<br>';
//}
$cliente = new Cliente();
$cliente->setNome("Rodrigo Angelo")->setEmail("*****@*****.**");
$serviceDb = new ServiceDb($conexao, $cliente);
foreach ($serviceDb->listar("id desc") as $c) {
    echo $c['nome'] . '<br>';
}
Beispiel #22
0
    public function findAllAssoc($ids)
    {
        if (!is_array($ids)) {
            $ids = array($ids);
        }
        $c = static::getModelName();
        $t = $c::getPersistentId();
        $d1 = array_pop($t);
        $d2 = array_pop($t);
        $e = array_pop(explode('_', static::getTableName()));
        // user_has_skill => skill
        $E = 'Model' . ucfirst($e);
        $k = array_pop($E::getPersistentId());
        $sth = ServiceDb::getInstance()->prepare('
				select `' . static::getTableName() . '`.*,`' . $e . '`.*
				from `' . static::getTableName() . '`
				left join `' . $e . '` on `' . static::getTableName() . '`.`' . $d1 . '`=`' . $e . '`.`' . $k . '`
				where `' . static::getTableName() . '`.`' . $d2 . '`=?');
        $sth->execute($ids);
        $arr = array();
        foreach ($sth->fetchAll() as $data) {
            $z = 'set' . ucfirst($e) . '2';
            $a = new $c();
            $a->hydrate($data);
            $x = new $E();
            $x->hydrate($data);
            $a->{$z}($x);
            $arr[] = $a;
        }
        return $arr;
    }