Delete record in patchentities in cakephp 3
<p>Some rows which are related to employee are needed to be updated
User can update some record and delete some record in same form.</p>

<p>while doing patch entity list of records which is already present in table are fetched and stored in list object and it is patched with data which comes by request.
But only records are updated not deleted while doing patch entity.</p>

<pre><code>$UserSkillsTable = \Cake\ORM\TableRegistry::get('UserSkills');

$list = $this-&gt;UserSkills
    -&gt;find('ALL')
    -&gt;contain(['MsSkills', 'MsSkills.MsSkillHeads', 'SkillLevels', 'RoSkillLevels'])
    -&gt;where([
        'UserSkills.emp_code' =&gt; $this-&gt;request-&gt;session()-&gt;read('user_emp_code'),
        'approve_status' =&gt; 'P',
        'UserSkills.is_active' =&gt; '1'
    ])
    -&gt;toArray();

$userSkillEntities = $this-&gt;UserSkills-&gt;patchEntities(
    $list,
    $this-&gt;request-&gt;data['old_user_skill']
);
</code></pre>