public function saveOrFail(EntityInterface $entity, $options = [])
    {
        $saved = $this->save($entity, $options);
        if ($saved === false) {
            throw new PersistenceFailedException($entity, ['save']);
        }

        return $saved;
    }
public function saveOrFail(EntityInterface $entity, $options = [])
    {
        $saved = $this->save($entity, $options);
        if ($saved === false) {
            throw new PersistenceFailedException($entity, ['save']);
        }

        return $saved;
    }
public function saveOrFail ( EntityInterface $ entity , $ options = [ ] ) { $ saved = $ this -> save ( $ entity , $ options ) ; if ( $ saved === false ) { throw new PersistenceFailedException ( $ entity , [ 'save' ] ) ; } return $ saved ; }
Try to save an entity or throw a PersistenceFailedException if the application rules checks failed,
the entity contains errors or the save was aborted by a callback.

@param \Cake\Datasource\EntityInterface $entity the entity to be saved
@param array|\ArrayAccess $options The options to use when saving.
@return \Cake\Datasource\EntityInterface
@throws \Cake\ORM\Exception\PersistenceFailedException When the entity couldn't be saved
@see \Cake\ORM\Table::save()
Try to save an entity or throw a PersistenceFailedException if the application rules checks failed the entity contains errors or the save was aborted by a callback .