Hi all,

Consider these models:

class Robots extends Model
{
    public $id;

    public $name;

    public function initialize()
    {
        $this->useDynamicUpdate(true);

        $this->hasMany("id", "Parts", "robots_id", 
          [
            'alias' => 'parts'
          ]
        );
    }
}

class Parts extends Model
{

    public $id;

    public $name;

    public $robots_id;

    public function initialize()
    {
        $this->useDynamicUpdate(true);

        $this->belongsTo("robots_id", "Robots", "id", 
          [
            'alias' => 'robot',
            "foreignKey" => true
          ]
        );
    }
}

When I want to fetch/change/save on Part, the foreignKey rule causes extra query.

$part = Parts::findFirst("id = 1");
$part->name = $part->name . ' new 1';
$result = $part->save();

SQL Log:

[Mon, 07 Dec 15 00:00:24 +0330][INFO] SELECT `parts`.`id`, `parts`.`name`, `parts`.`robots_id` FROM `parts` WHERE `parts`.`id` = 1 LIMIT :APL0 [1]
[Mon, 07 Dec 15 00:00:24 +0330][INFO] SELECT COUNT(*) AS `rowcount` FROM `robots` WHERE `robots`.`id` = :0 [1]
[Mon, 07 Dec 15 00:00:24 +0330][INFO] UPDATE `parts` SET `name` = ? WHERE `id` = ? [Sample Robot Part 1 new 1, 1]

Why we should have foreignKey check on Parts table (and extra query) when I just trying to change name field?!

Thanks.