Skip to content

Instantly share code, notes, and snippets.

View hmic's full-sized avatar

Hans-Joachim Michl hmic

  • Living in China/Shenzhen, from Germany, Hessen, nearby Frankfurt/Main
View GitHub Profile
<?php
// Posts hasMany Images
// Posts hasOne FeaturedImages: where featured image is the first image for that post.
$this->hasOne('FeaturedImages', [
'className' => 'Images',
'foreignKey' => false,
'conditions' => function ($exp, $query) {
$subquery = $query