cakePhp 3加入两个不相关的mysql表(松散相关)

I inherited a database with a weird (maybe not) design. I'm migrating to cakePHP but modifying it will break up lot of things so I want to keep it as it is.

I have two tables clothes and pictures,clothes has this fields :

clothes
{
ean
reference
reference_name
size 
color
}

ean (european article number) is the unique id, every ean is a unique combination of reference color and size, but a reference has multiple pictures that are shared by the different clothes (sizes and colors, there is no consistency between the color or sizes and the pictures).

pictures
{
id
id_reference
reference_name
picture
}

"id_reference" matches the "reference" field in the clothes table but they are not formally related they are not marked as foreign keys.

I have this function to retrieve a JSON array

public function women() 
 {
 $page = $_POST['page'];
 $this->autoRender = false;
$articles = TableRegistry::get('Clothes');
$results = $page;
if(is_numeric($page))
{
$pageNumber = (int)$page;
$results = $articles->find('all',['page'=>1])
    ->select(['reference','nombre'])
    ->where(['Clothes.reference_name' => 'WOMEN'])
    ->group('reference')
    ->limit(10)
    ->contain(['Pictures']);
}

 $this->response->body(json_encode($results));
 return $this->response;

}

class ClothesTable extends Table
{
public function initialize(array $config)
    {
        $this->hasMany('Pictures', [
            'className' => 'Pictures',
            'foreignKey' => 'id_reference',
            'bindingKey' => 'reference'
        ]);
    }
}

I tried some of the methods in the oficial documentation but cakephp throws an error (the two tables are not related). Right now the JSON string contains an empty pictures=[] array. Does anyone knows how can I retrieve the picture list in the JSON response?

i guess there are two ways to do this. Either you declare a explicit foreign key. Or else use plain sql in place of cakephp's. As you say you dont have the luxury to modify, i bet going the sql way is better.