Skip to content

Conversation

@cleptric
Copy link
Member

As promised in cakephp/cakephp#10164, here are the docs for Cake\ORM\Table::saveOrFail() and Cake\ORM\Table::deleteOrFail().
I hope I covered everything necessary.

On a site note, using the provided Dockerfile worked like a charme 👍

Using this method will throw an :php:exc:`Cake\\ORM\\Exception\\PersistenceFailedException`
if the application rules checks failed, the entity contains errors or the save was aborted by a callback.
Using this can be helpful when you performing complex database operations without human monitoring,
for example, inside a Shell task.
Copy link
Member

@dereuromark dereuromark Feb 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add:

Do not use this for validation inside controller actions and where feedback to the user has to be given in forms.

etc?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good point!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One could use it there if they catch the exception.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah but not without catching it then :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'Do not use' is pretty strongly worded when it can be used if you catch the resulting exceptions.

@inoas
Copy link
Contributor

inoas commented Feb 17, 2017

Now you made me feel all fuzzy about the docker file. Is it available in general on some repo or who is the source? @cleptric ;)

Edit: NVM thought it was a cakephp/app docker ;)

@markstory markstory added this to the 3.x milestone Feb 17, 2017
@antograssiot
Copy link
Contributor

@inoas you should have a look to the readme.

echo $e->getEntity();
}

As this internally perfoms a :php:meth:`Cake\\ORM\\Table::delete()` call, all corresponding delete events will be triggered.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/perfoms/performs

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix that post-merge.

@markstory markstory merged commit 2d222cb into cakephp:3.0 Feb 18, 2017
markstory added a commit that referenced this pull request Feb 18, 2017
HavokInspiration added a commit that referenced this pull request Jun 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants