Code Duplication    Length = 9-9 lines in 2 locations

src/ORM/Table.php 2 locations

@@ 1961-1969 (lines=9) @@
1958
     * @throws \Cake\ORM\Exception\PersistenceFailedException When the entity couldn't be saved
1959
     * @see \Cake\ORM\Table::save()
1960
     */
1961
    public function saveOrFail(EntityInterface $entity, $options = [])
1962
    {
1963
        $saved = $this->save($entity, $options);
1964
        if ($saved === false) {
1965
            throw new PersistenceFailedException($entity, ['save']);
1966
        }
1967
1968
        return $saved;
1969
    }
1970
1971
    /**
1972
     * Performs the actual saving of an entity based on the passed options.
@@ 2328-2336 (lines=9) @@
2325
     * @throws \Cake\ORM\Exception\PersistenceFailedException
2326
     * @see \Cake\ORM\Table::delete()
2327
     */
2328
    public function deleteOrFail(EntityInterface $entity, $options = [])
2329
    {
2330
        $deleted = $this->delete($entity, $options);
2331
        if ($deleted === false) {
2332
            throw new PersistenceFailedException($entity, ['delete']);
2333
        }
2334
2335
        return $deleted;
2336
    }
2337
2338
    /**
2339
     * Perform the delete operation.