Abstraction of data between two tables using datalayer

Asked

Viewed 56 times

0

I’m using the https://github.com/robsonvleite/datalayer

I need to do the table data abstraction projects. As the projects table has relationship with others, together I need to abstract data from the tables Register and Countries.

In Models I have:

Cadastro.php

<?php
namespace Source\Models;
use CoffeeCode\DataLayer\DataLayer;

class Cadastro extends DataLayer
{
    public function __construct()
    {
        parent::__construct("cadastro", []);
    }
}

Php countries.

<?php
namespace Source\Models;
use CoffeeCode\DataLayer\DataLayer;

class Pais extends DataLayer
{
    public function __construct()
    {
        parent::__construct("paises", []);
    }
}

Php projects.

<?php
namespace Source\Models;
use CoffeeCode\DataLayer\DataLayer;

class Projeto extends DataLayer
{
    public function __construct()
    {
        parent::__construct("projetos", []);
    }
}

On the screen where I display the projects:

<?php
require __DIR__ . "/vendor/autoload.php";

$model = new \Source\Models\Projeto();
$projetos = $model->find("url = :url", "url=".$_GET['url']."")->fetch();

foreach ($projetos as $projeto){ 
   echo $projeto->titulo
}
?>

How to do, so that in the same abstraction $projeto-> I can bring data from other tables?

  • Basic question: This Datalayer supports the relationship of tables?

  • @Woss Yes, this video explains, but speaking of another table, not being able to understand. https://www.youtube.com/watch?v=eD067TOeE-k

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.