Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flush : Sluggable expects to have at least one usable (non-empty) field from the following: [ name #40

Open
sglessard opened this issue Apr 2, 2015 · 2 comments
Assignees
Labels

Comments

@sglessard
Copy link

Sluggable is a bit too finicky. With Em->flush() it raises error where it's not supposed to.
Examples :

  • Saving an Ad entity (Sluggable error because some Section are not translated)
    BaseSluggableListener ->doGenerateSlug (object(OnFlushEventArgs), object(SectionTranslation)) in ~/vendor/unifik/doctrine-behaviors- bundle/Unifik/DoctrineBehaviorsBundle/ORM/Sluggable/BaseSluggableListener.php at line 118
  • Mass delete BlogArticle (Sluggable error because some Article are not translated)
    BaseSluggableListener ->doGenerateSlug (object(OnFlushEventArgs), object(ArticleTranslation)) in ~/vendor/unifik/doctrine-behaviors-bundle/Unifik/DoctrineBehaviorsBundle/ORM/Sluggable/BaseSluggableListener.php at line 118
@tiois
Copy link
Contributor

tiois commented Apr 2, 2015

Use $em->flush($entity) instead of $em->flush()

@sglessard
Copy link
Author

You mean (Ad example) :

$this->getEm()->flush([$ad, $ad->getTranslation()]);

foreach ($ad->getUrls() as $url) {
    $this->getEm()->flush($url);
}

If I only flush($ad), AdTranslation is not saved, nor the AdUrls.

@tiois tiois added the bug label Apr 9, 2015
@tiois tiois self-assigned this Apr 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants