Flag of Ukraine
SymfonyCasts stands united with the people of Ukraine
This tutorial has a new version, check it out!

Sluggable & other Wonderful Behaviors

Keep on Learning!

If you liked what you've learned so far, dive in!
Subscribe to get access to this tutorial plus
video, code and script downloads.

Start your All-Access Pass
Buy just this tutorial for $12.00

With a Subscription, click any sentence in the script to jump to that part of the video!

Login Subscribe

We're using Faker to generate a random slug for each dummy article. Thanks to this, back on the homepage, look at the URLs: they're truly random slugs: they have no relation to the title.

But, really, shouldn't the slug be generated from the title? What I mean is, if I set the Article's title, something should automatically convert that into a slug and make sure it's unique in the database. We shouldn't need to worry about doing that manually.

And... yea! There's a really cool library that can do this, and a bunch of other magic! Google for StofDoctrineExtensionsBundle, and then click into its documentation.

Ok, let me explain something: there is a normal, PHP library called DoctrineExtension, which can add a lot of different behaviors to your entities, like sluggable, where you automatically generate the slug from another field. Other behaviors include Loggable, where each change to an entity is tracked, or Blameable, where the user who created or updated an entity is automatically recorded.

Installing StofDoctrineExtensionsBundle

This bundle - StofDoctrineExtensionsBundle - helps to integrate that library into a Symfony project. Copy the composer require line, find your terminal, and paste!

Tip

stof/doctrine-extensions-bundle is now compatible with Symfony 5 - you can use it instead of antishov/doctrine-extensions-bundle fork

composer require antishov/doctrine-extensions-bundle

While that's working, let's go check out the documentation. This is a wonderful library, but its documentation is confusing. So, let's navigate to the parts we need. Scroll down to find a section called "Activate the extensions you want".

As we saw, there are a lot of different, possible behaviors. For performance reasons, when you install this bundle, you need to explicitly say which behaviors you want, like timestampable, by setting it to true.

Contrib Recipes

Move back to the terminal to see if things are done. Oh, interesting! It stopped! And it's asking us if we want to install the recipe for StofDoctrineExtensionsBundle. Hmm... that's weird... because Flex has already installed many other recipes without asking us a question like this.

But! It says that the recipe for this package comes from the "contrib" repository, which is open to community contributions. Symfony has two recipe repositories. The main repository is closely controlled for quality. The second - the "contrib" repository - has some basic checks, but the community can freely contribute recipes. For security reasons, when you download a package that installs a recipe from that repository, it will ask you first before installing it. And, there's a link if you want to review the recipe.

I'm going to say yes, permanently. Now the recipe installs.

Configuring Sluggable

Thanks to this, we now have a shiny new config/packages/stof_doctrine_extensions.yaml file:

# Read the documentation: https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html
# See the official DoctrineExtensions documentation for more details: https://github.com/Atlantic18/DoctrineExtensions/tree/master/doc/
stof_doctrine_extensions:
default_locale: en_US

This is where we need to enable the extensions we want. We want sluggable. We can use the example in the docs as a guide. Add orm, then default. The default is referring to the default entity manager... because some projects can actually have multiple entity managers. Then, sluggable: true:

# Read the documentation: https://symfony.com/doc/current/bundles/StofDoctrineExtensionsBundle/index.html
# See the official DoctrineExtensions documentation for more details: https://github.com/Atlantic18/DoctrineExtensions/tree/master/doc/
stof_doctrine_extensions:
default_locale: en_US
orm:
default:
sluggable: true

As soon as we do this... drumroll... absolutely nothing will happen. Ok, behind the scenes, the bundle is now looking for slug fields on our entities. But, we need a little bit more config to activate it for Article. Open that class and find the slug property.

Now, go back to the documentation. Another confusing thing about this bundle is that the documentation is split in two places: this page shows you how to configure the bundle... but most of the docs are in the library. Scroll up and find the DoctrineExtensions Documentation link.

Awesome. Click into sluggable.md. Down a bit... it tells us that to use this feature, we need to add an @Gedmo\Slug() annotation above the slug field. Let's do it! Use @Gedmo\Slug, then fields={"title"}:

... lines 1 - 5
use Gedmo\Mapping\Annotation as Gedmo;
... lines 7 - 10
class Article
{
... lines 13 - 24
/**
... line 26
* @Gedmo\Slug(fields={"title"})
*/
private $slug;
... lines 30 - 154
}

That's all we need! Back in ArticleFixtures, we no longer need to set the slug manually (remove it):

... lines 1 - 7
class ArticleFixtures extends BaseFixture
{
... lines 10 - 26
public function loadData(ObjectManager $manager)
{
$this->createMany(Article::class, 10, function(Article $article, $count) {
$article->setTitle($this->faker->randomElement(self::$articleTitles))
->setSlug($this->faker->slug)
... lines 32 - 49
);
... lines 51 - 60
});
... lines 62 - 63
}
}

Try it out: find your terminal, and load those fixtures!

php bin/console doctrine:fixtures:load

No errors! That's a really good sign, because the slug column is required in the database. Go back to the homepage and... refresh! Brilliant! The slug is clean and clearly based off of the title! As an added benefit, look at how some of these have a number on the end. The Sluggable behavior is making sure that each slug is unique. So, if a slug already exists in the database, it adds a -1 , -2, -3, etc. until it finds an open space.

Hello Doctrine Events

Side note: this feature is built on top of Doctrine's event system. Google for "Doctrine Event Subscriber". You'll find a page on the Symfony documentation that talks about this very important topic. We're not going to create our own event subscriber, but it's a really powerful idea. In this example, they talk about how you could use the event system to automatically update a search index, each time any entity is created or updated. Behind the scenes, the sluggable features works by adding an event listener that is called right before saving, or "flushing", any entity.

If you ever need to do something automatically when an entity is added, updated or removed, think of this system.

Next, let's find out how to rescue things when migrations go wrong!

Leave a comment!

64
Login or Register to join the conversation
Christopher R. Avatar
Christopher R. Avatar Christopher R. | posted 3 years ago

Hey guys! Was curious if someone could shed some light on the following deprecation warning that I'm seeing in the profiler logs:

A tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0.

It looks like this is/was being dealt with here and that a fix was merged in for the symfony/maker-bundle, but the trace shows the warning starting in .../vendor/stof/doctrine-extensions-bundle/DependencyInjection/Configuration.php:17. When it's all said and done, it looks like 10 deprecation messages are logged.

Any idea what might be going on? Anything I can do to fix the deprecations, or will this be fixed in 4.3?

Thanks guys! Loving the well-constructed tutorials!

2 Reply
Default user avatar
Default user avatar Tomáš Votruba | Christopher R. | posted 2 years ago

gedmo/stof extensions are dead since 2017.
This will help: https://github.com/KnpLabs/...

Reply

Hey Tomas,

Really sad to hear it! Is it official info? Any links that officially confirm they are abandoned except the fact they are *very* slow on pushing things forward?

And thanks for sharing the link to KnpLabs/DoctrineBehaviors - it's a really good alternative IMO.

Cheers!

1 Reply
Default user avatar
Default user avatar Tomáš Votruba | victor | posted 2 years ago

Hey,

it's Github info, as you can see yourself. I don't know any mantainers who would be on time to tell people "the package is dead" even if everyone can see it for last 2 years. We miss this honesty in open-source, though it would help lot of project to re-enter legacy.

If you have any troubles with DoctrineBehaviors, just create an issue on Github.

Btw, Rector migration from gedmo/stof to KnpLabs is more than 50 % ready: https://github.com/rectorph...

Reply

Hey Tomas,

Thank you for sharing your thoughts about it. And good to know that Rector could help with some migrations if needed!

Cheers!

2 Reply
Default user avatar
Default user avatar Tomáš Votruba | victor | posted 2 years ago

Doctrine Behaviors 2 is out!

https://www.tomasvotruba.cz...

Reply

Hey Tomas,

Yay! Thank you for all your huge job in that bundle! That's GREAT it supports Symfony 5 now :)

Cheers!

1 Reply
Edward B. Avatar

The bundle is working well for sluggable and timestampable chapters here, with Symfony 5. I needed to add to config/services.yaml:


Knp\DoctrineBehaviors\EventSubscriber\SluggableSubscriber:
tags:
- { name: 'doctrine.event_subscriber' }

Knp\DoctrineBehaviors\EventSubscriber\TimestampableSubscriber:
tags:
- { name: 'doctrine.event_subscriber' }

Knp\DoctrineBehaviors\Repository\DefaultSluggableRepository:
class: Knp\DoctrineBehaviors\Repository\DefaultSluggableRepository

For the article class:


class Article implements SluggableInterface, TimestampableInterface
{
use SluggableTrait;
use TimestampableTrait;

/**
* @return string[]
*/
public function getSluggableFields(): array
{
return ['title', 'rand'];
}

/**
* @return string
* @throws Exception
*/
public function getRand(): string
{
return (string)random_int(1000000, 9999999);
}
Reply

Hey Ed,

Thank you for sharing your solution of using KnpLabs/DoctrineBehaviors bundle. I'm not a big fan of random number in slugs, but probably it's the easiest and quickest solution to make slugs unique with this bundle.

Cheers!

Reply
Edward B. Avatar

Victor, I completely agree on the random number bit. That was a quick hack to get through the tutorial - and it was a good excuse to see if a virtual field works as I was expecting. It does!

Reply

Hey Ed,

Ah, sure, then it fits perfect in this case! I did the same if I would need a quick hack to follow the tutorial I think ;)

Cheers!

Reply
Default user avatar
Default user avatar Tomáš Votruba | victor | posted 2 years ago

Cheers :)

The migration path is half-ready: https://github.com/rectorph...
Now it needs testing in user-land.

I'll write about it in next 1-2 weeks

Reply
Ozornick Avatar

I have the same problems. 20 posts deprecated. "A tree builder without a root node is deprecated since Symfony 4.2 and will not be supported anymore in 5.0."

Reply

Hey Ozornick

Yes, we added a note about that deprecation here: https://symfonycasts.com/sc...

Cheers!

1 Reply
Ozornick Avatar

IYes, I tried to search. But the error is in the vendor/ package. Is it undesirable to change it?

namespace Stof\DoctrineExtensionsBundle\DependencyInjection;

public function getConfigTreeBuilder()
{
$treeBuilder = new TreeBuilder();
$rootNode = $treeBuilder->root('stof_doctrine_extensions');
...

Reply

Ohh, in that case you can open an issue, or even better send a pull request to the vendor's project :)

BTW, it won't affect you until Symfony 5, so you can just forget about it for awhile

Cheers!

Reply

Hey @Christopher

It's caused by outdated stof/doctrine-extensions-bundle. Where have you got this deprecation message? Is it in our course code? Have you followed course from the start? or playing with finish directory?

Cheers!

Reply
Christopher R. Avatar
Christopher R. Avatar Christopher R. | sadikoff | posted 3 years ago

I used this thread as a reference, deleted my vendor directory, removed the reference from the symfony.lock file, and finally ran composer install from command line. Funny enough, the composer.lock file still fails to update to version 1.3 and I still get all the same deprecation warnings.

Reply

Hey Christopher!

Try running composer update. The version in your symfony.lock file isn't actually the version you have installed - it's just the version of the "recipe" that was originally used when it was first installed. As you noted, the *true* version you have installed can be found in composer.lock (or via composer show stof/doctrine-extensions-bundle. However, running composer install doesn't update the composer.lock file - it just reinstalls the version that are listed in that file. To force it to actually download the *newest* version of a library, use composer update.

Let us know if this helps!

Cheers!

Reply
Christopher R. Avatar
Christopher R. Avatar Christopher R. | weaverryan | posted 3 years ago

Hey Ryan!

Thanks for the reply. Yep. I've done all those things as well. I even deleted the composer.lock file, made sure that I had the latest version in my composer.json file ("stof/doctrine-extensions-bundle": "^1.3"), and then ran composer install once again. Still had all the same deprecation warnings plus many more as a result of upgrading to Symfony 4.3.

I'm curious if this is playing a part in the whole ordeal - https://github.com/stof/Sto.... Perhaps we're just dealing with a tag issue?

Thanks so much for any feedback, Ryan!

1 Reply

Ah, indeed! It looks likely that the tag is the issue! Hopefully we can get a tag soon :)

Reply
Christopher R. Avatar
Christopher R. Avatar Christopher R. | weaverryan | posted 3 years ago

Awesome! Thanks for looking into that for us, Ryan.

Reply
Christopher R. Avatar
Christopher R. Avatar Christopher R. | sadikoff | posted 3 years ago

Thanks for the reply, Vladimir

The message is seen in the profiler logs. I have been following the tutorials, one after another, but perhaps I've missed something at some point. If it helps, I'm using this in composer.json (which appears to be the latest version on packagist):

"stof/doctrine-extensions-bundle": "^1.3"

Then in stof_doctrine_extensions.yaml:

stof_doctrine_extensions:
default_locale: en_US
orm:
default:
sluggable: true
timestampable: true

Would there be another location that config is necessary?

**UPDATE**
I just checked my symfony.lock file and for whatever reason, it's using 1.2. I'll try fixing things from that file as well.

Reply
Christopher R. Avatar

Sorry, the stof_doctrine_extensions.yaml config spaces were removed by the browser. They're indented on my end though.

Reply
infete Avatar

Hi, I have followed exactly same steps, but somehow sluggable is not working. Here is commit related to that: https://github.com/napester...
I am getting this error:
In PDOStatement.php line 119:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'slug' cannot be null


In PDOStatement.php line 117:

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'slug' cannot be null

1 Reply

Hey infete!

Hmm. I just tried the latest commit on your repository - and it looks like it's working fine now - no errors when I load the fixtures and the slug is being set correctly. Are you till having problems?

Cheers!

1 Reply
infete Avatar

Hi, yes now it works perfectly. Most probably it was a cache issue on windows system. But works great on Linux.
Thanks so much

Reply

Hi everybody ;)

I didin't find :
- StofDoctrineExtensionsBundle
- antishov/doctrine-extensions-bundle

But the issue was solved with https://github.com/doctrine...


composer require gedmo/doctrine-extensions

add in doctorine.yaml.


orm:
sluggable:
type: annotation
alias: Gedmo
prefix: Gedmo\Sluggable\Entity
# make sure vendor library location is correct
dir: "%kernel.root_dir%/../vendor/gedmo/doctrine-extensions/src/Sluggable/"

check your config it's right:


php ./bin/console doctrine:fixture:load

# output
Found 1 mapped entities:
[OK] App\Entity\Article

and create file doctrine_extensions.yaml


services:
gedmo.listener.sluggable:
class: Gedmo\Sluggable\SluggableListener
tags:
- { name: doctrine.event_subscriber, connection: default }
calls:
- [ setAnnotationReader, [ "@annotation_reader" ] ]

uncomment the slug in ArtcliFixture

and test your code ;)

Reply

Hey NicolasZ,

Yes, the library you're referencing to ( https://github.com/doctrine... ) is actually caused that issue with their major release :) In the screencast, we use the bundle that is kind of wrapper around the library you linked in your comment that provides some nice integrations with that core library. So, basically, you show how to do things low-level without using the bundle. But now StofDoctrineExtensionsBundle supports this major release so it should work well.

Cheers!

Reply
Tarek H. Avatar
Tarek H. Avatar Tarek H. | posted 2 years ago

composer updated symfony to 4.4.13 , so far i'm unable to install ago bundle and antishov so how can i downgrade to the version of the source code ?

here is the error

Problem 1
- Conclusion: don't install antishov/doctrine-extensions-bundle v1.4.2
- Conclusion: don't install antishov/doctrine-extensions-bundle v1.4.1
- Conclusion: remove doctrine/cache 1.10.2
- Conclusion: don't install doctrine/cache 1.10.2
- doctrine/common 2.2.1 conflicts with doctrine/cache[1.10.2].
- doctrine/common 2.2.2 conflicts with doctrine/cache[1.10.2].
- doctrine/common 2.2.3 conflicts with doctrine/cache[1.10.2].
- doctrine/common 2.3.0 conflicts with doctrine/cache[1.10.2].
- Conclusion: don't install doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|install doctrine/common 2.2.3|install doctrine/common 2.3.0
- Conclusion: don't install antishov/doctrine-extensions-bundle v1.4.2|remove doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|install doctrine/common 2.2.3|install doctrine/common 2.3.0
- Conclusion: don't install antishov/doctrine-extensions-bundle v1.4.2|don't install doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|install doctrine/common 2.2.3|install doctrine/common 2.3.0
- Conclusion: don't install antishov/doctrine-extensions-bundle v1.4.2|remove doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|install doctrine/common 2.2.3|install doctrine/common 2.3.0
- Conclusion: don't install antishov/doctrine-extensions-bundle v1.4.2|don't install doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|install doctrine/common 2.2.3|install doctrine/common 2.3.0
- Conclusion: don't install antishov/doctrine-extensions-bundle v1.4.1|remove doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|install doctrine/common 2.2.3|install doctrine/common 2.3.0
- Conclusion: don't install antishov/doctrine-extensions-bundle v1.4.1|don't install doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|install doctrine/common 2.2.3|install doctrine/common 2.3.0
- Installation request for doctrine/cache (locked at 1.10.2) -> satisfiable by doctrine/cache[1.10.2].
- Conclusion: don't install antishov/doctrine-extensions-bundle v1.4.1|remove doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|install doctrine/common 2.2.3|install doctrine/common 2.3.0
- Conclusion: don't install antishov/doctrine-extensions-bundle v1.4.1|don't install doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|install doctrine/common 2.2.3|install doctrine/common 2.3.0
- Installation request for antishov/doctrine-extensions-bundle ^1.4 -> satisfiable by antishov/doctrine-extensions-bundle[v1.4.0, v1.4.1, v1.4.2].
- Conclusion: remove doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|install doctrine/common 2.2.3|install doctrine/common 2.3.0
- antishov/doctrine-extensions-bundle v1.4.0 requires gedmo/doctrine-extensions ^2.3.4 -> satisfiable by gedmo/doctrine-extensions[v2.3.10, v2.3.11, v2.3.12, v2.3.4, v2.3.5, v2.3.6, v2.3.7, v2.3.8, v2.3.9, v2.4.0, v2.4.1, v2.4.10, v2.4.11, v2.4.12, v2.4.13, v2.4.14, v2.4.15, v2.4.16, v2.4.17, v2.4.18, v2.4.19, v2.4.2, v2.4.20, v2.4.21, v2.4.22, v2.4.23, v2.4.24, v2.4.25, v2.4.26, v2.4.27, v2.4.28, v2.4.29, v2.4.3, v2.4.30, v2.4.31, v2.4.32, v2.4.33, v2.4.34, v2.4.35, v2.4.36, v2.4.37, v2.4.38, v2.4.39, v2.4.4, v2.4.40, v2.4.41, v2.4.42, v2.4.5, v2.4.6, v2.4.7, v2.4.8, v2.4.9].
- gedmo/doctrine-extensions v2.3.10 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.3.11 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.3.12 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.0 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.1 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.10 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.11 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.12 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.13 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.14 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.15 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.16 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.17 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.18 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.19 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.2 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.20 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.21 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.22 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.23 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.24 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.25 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.26 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.27 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.28 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.29 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.3 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.30 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.31 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.32 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.33 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.34 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.35 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.36 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.37 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.38 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.39 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.4 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.40 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.41 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.42 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.5 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.6 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.7 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.8 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.4.9 requires doctrine/common ~2.4 -> satisfiable by doctrine/common[2.12.0, 2.13.0, 2.13.1, 2.13.2, 2.13.3, v2.10.0, v2.11.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3, v2.5.0, v2.5.1, v2.5.2, v2.5.3, v2.6.0, v2.6.1, v2.6.2, v2.7.0, v2.7.1, v2.7.2, v2.7.3, v2.8.0, v2.8.1, v2.9.0].
- gedmo/doctrine-extensions v2.3.4 requires doctrine/common >=2.2,<2.5-dev -> satisfiable by doctrine/common[2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3].
- gedmo/doctrine-extensions v2.3.5 requires doctrine/common >=2.2,<2.5-dev -> satisfiable by doctrine/common[2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3].
- gedmo/doctrine-extensions v2.3.6 requires doctrine/common >=2.2,<2.5-dev -> satisfiable by doctrine/common[2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3].
- gedmo/doctrine-extensions v2.3.7 requires doctrine/common >=2.2,<2.5-dev -> satisfiable by doctrine/common[2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3].
- gedmo/doctrine-extensions v2.3.8 requires doctrine/common >=2.2,<2.5-dev -> satisfiable by doctrine/common[2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3].
- gedmo/doctrine-extensions v2.3.9 requires doctrine/common >=2.2,<2.5-dev -> satisfiable by doctrine/common[2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, v2.4.0, v2.4.1, v2.4.2, v2.4.3].
- Can only install one of: doctrine/common[2.13.0, 3.0.2].
- Can only install one of: doctrine/common[2.13.1, 3.0.2].
- Can only install one of: doctrine/common[2.13.2, 3.0.2].
- Can only install one of: doctrine/common[2.13.3, 3.0.2].
- Can only install one of: doctrine/common[2.12.0, 3.0.2].
- Can only install one of: doctrine/common[2.2.0, 3.0.2].
- Can only install one of: doctrine/common[v2.10.0, 3.0.2].
- Can only install one of: doctrine/common[v2.11.0, 3.0.2].
- Can only install one of: doctrine/common[v2.4.0, 3.0.2].
- Can only install one of: doctrine/common[v2.4.1, 3.0.2].
- Can only install one of: doctrine/common[v2.4.2, 3.0.2].
- Can only install one of: doctrine/common[v2.4.3, 3.0.2].
- Can only install one of: doctrine/common[v2.5.0, 3.0.2].
- Can only install one of: doctrine/common[v2.5.1, 3.0.2].
- Can only install one of: doctrine/common[v2.5.2, 3.0.2].
- Can only install one of: doctrine/common[v2.5.3, 3.0.2].
- Can only install one of: doctrine/common[v2.6.0, 3.0.2].
- Can only install one of: doctrine/common[v2.6.1, 3.0.2].
- Can only install one of: doctrine/common[v2.6.2, 3.0.2].
- Can only install one of: doctrine/common[v2.7.0, 3.0.2].
- Can only install one of: doctrine/common[v2.7.1, 3.0.2].
- Can only install one of: doctrine/common[v2.7.2, 3.0.2].
- Can only install one of: doctrine/common[v2.7.3, 3.0.2].
- Can only install one of: doctrine/common[v2.8.0, 3.0.2].
- Can only install one of: doctrine/common[v2.8.1, 3.0.2].
- Can only install one of: doctrine/common[v2.9.0, 3.0.2].
- Installation request for doctrine/common (locked at 3.0.2) -> satisfiable by doctrine/common[3.0.2].
Reply

Hey Tarek,

The easiest way would be to download the course code and replace your composer.lock with the one from the start/ directory. But you will need to install all the missing packages again. Or you can take the composer.lock from the finish/ directory that already will hold all the necessary dependencies for this course. Let me know if it helps!

Cheers!

Reply
Bilel T. Avatar

Hi Victor,

I have the same issue that Tarek has and sadly the solution proposed here doesn't work.

It has to do with the bundle version I think,
The newest versions aren't compatible with Symfony 4.4.* and the oldest are only compatible with Symfony 2.2 ~ 3.* versions

I still can't find a solution tho..

Reply
Bilel T. Avatar

Found A Solution, you simply need to downgrade the doctrine/common to 2.13 so that it matches the Gedmo required version and the extensions bundle:

composer require doctrine/common:^2.13.3 --update-with-dependencies

and you're OK to go.

1 Reply
Tarek H. Avatar

Thanks Bilel cheers , and thank u victor for trying to help

Reply

Hey Bilel,

Thank you for sharing your solution with others! Yeah, sometimes it's difficult for Composer to find a correct package especially when there were a major version change. Specifying the version explicitly may help.

Cheers!

Reply
Deplaine N. Avatar
Deplaine N. Avatar Deplaine N. | posted 2 years ago

Hello,
I can't install stof/doctrine-extensions-bundle.

I get the following error message:

Using version ^1.4 for stof/doctrine-extensions-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Restricting packages listed in "symfony/symfony" to "4.4.*"
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Conclusion: remove doctrine/cache 1.10.2
- Conclusion: don't install doctrine/cache 1.10.2
- doctrine/common 2.2.1 conflicts with doctrine/cache[1.10.2].
- doctrine/common 2.2.2 conflicts with doctrine/cache[1.10.2].
- doctrine/common 2.2.3 conflicts with doctrine/cache[1.10.2].
- doctrine/common 2.3.0 conflicts with doctrine/cache[1.10.2].
- Installation request for doctrine/cache (locked at 1.10.2) -> satisfiable by doctrine/cache[1.10.2].
- Installation request for stof/doctrine-extensions-bundle ^1.4 -> satisfiable by stof/doctrine-extensions-bundle[v1.4.0].
- Conclusion: don't install doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|install doctrine/common 2.2.3|install doctrine/common 2.3.0
- Conclusion: remove doctrine/common 3.0.2|install doctrine/common 2.2.1|install doctrine/common 2.2.2|install doctrine/common 2.2.3|install doctrine/common 2.3.0
- stof/doctrine-extensions-bundle v1.4.0 requires gedmo/doctrine-extensions ^2.3.4 -> satisfiable by gedmo/doctrine-extensions[v2.3.10, v2.3.11, v2.3.12, v2.3.4, v2.3.5, v2.3.6, v2.3.7, v2.3.8, v2.3.9, v2.4.0, v2.4.1, v2.4.10, v2.4.11, v2.4.12, v2.4.13, v2.4.14, v2.4.15, v2.4.16, v2.4.17, v2.4.18, v2.4.19, v2.4.2, v2.4.20, v2.4.21, v2.4.22, v2.4.23, v2.4.24, v2.4.25, v2.4.26, v2.4.27, v2.4.28, v2.4.29, v2.4.3, v2.4.30, v2.4.31, v2.4.32, v2.4.33, v2.4.34, v2.4.35, v2.4.36, v2.4.37, v2.4.38, v2.4.39, v2.4.4, v2.4.40, v2.4.41, v2.4.42, v2.4.5, v2.4.6, v2.4.7, v2.4.8, v2.4.9

Can you help me ?

Reply
Deplaine N. Avatar

Solution :
Downgrade doctrine/common from 3.0 to 2.7

composer require doctrine/common:^2.7 --update-with-dependencies

Source : https://github.com/stof/Sto...

1 Reply

Hey Deplaine N.

Does this doctrine/common:3.0 is installed by course code? Or you updated course code? Or it's your own code?

Cheers

Reply
Mamadou iliassa S. Avatar
Mamadou iliassa S. Avatar Mamadou iliassa S. | posted 2 years ago

Hello guys ! having some error when I use "sluggable" in my entity on the slug fields,

I have follow the exact same way to the tutorial but here is the hug error I get


There is no extension able to load the configuration for "stof_doctrine_extensions" (in "/symfony_project/config/packages/stof_doctrine_extensions.yaml"). Looked for namespace "stof_doctrine_extensions", found
""framework", "twig", "twig_extra", "sensio_framework_extra", "doctrine", "doctrine_migrations", "security", "web_profiler",
"monolog", "debug", "maker", "webpack_encore", "knp_time"" in /symfony_project/config
/packages/stof_doctrine_extensions.yaml (which is being imported from "/symfony_project/src/Kernel.php").

Reply

Hey Mamadou iliassa S.

It seems to me that you forgot to install StofDoctrineExtensionsBundle bundle. Could you double check it?

Cheers!

Reply
Denis Ž. Avatar
Denis Ž. Avatar Denis Ž. | posted 2 years ago

Seems like `StofDoctrineExtensionsBundle` 1.4.0 supports Symfony 5: https://github.com/stof/Sto...

Reply

That's great! Thanks for the heads up Denis Ž.

Reply

Not sure about this but one important line which is missing in the Course Script but present in the video is the removal of the line

->setSlug($this->faker->slug)

from the loadData function in the ArticleFixtures.php class. Hope that helps

Reply

Hey jpfortuno!

Thanks for catching that! When we only "remove" a line... it's a tough thing to show in the code block... but I think we should at least try by showing the new code but with the line missing. We'll add a code block.

Cheers!

Reply
Neal O. Avatar
Neal O. Avatar Neal O. | posted 3 years ago

Working on Windows 10 after reloading the doctrine fixtures in the data base when I refresh the home page the php server dies with the following error:

Compile Error: ContainerNB37shz\srcDevDebugProjectContainer::load(): Failed opening required 'C:\Projects\the_spacebar\var\cache\dev\ContainerNB37shz\getConsole_ErrorListenerService.php' (include_path='C:\xampp\php\PEAR')

any help on figuring out what is happening would be appreciated.

Reply

Hey Neal O.

It looks like a permissions problem. Try changing the permissions of that folder and try again.

Cheers!

Reply
Mike P. Avatar
Mike P. Avatar Mike P. | posted 3 years ago

Is it possible to use sluggable without a field it is maped by?
I need a custom slug which is not connected to any field inside the DB.

But after over 1 hour googling and trial&error the best I came up with, is to create a $slugPlaceholder column which holds the string that gets converted into $slug.
But it seems to be "overhead" for my use case, because $slugPlaceholder is not really needed as column.

I've tried to use temporary $slugPlaceholder variable, but the 'fields' annotation of slugable seems to only accept "real" columns?!
Is there any alternative to get rid of $slugPlaceholder and use only $slug?

Current code:

/**
* slugPlaceholder which is to become $slug
* @ORM\Column(type="string", length=255, unique=true)
*/
private $slugPlaceholder;

/**
* @ORM\Column(type="string", length=255, unique=true)
* @Gedmo\Slug(fields={"slugPlaceholder"})
*/
private $slug;
...
public function getSlugPlaceholder(): ?string
{
return $this->slugPlaceholder;
}

// Gets automatically converted to $slug via sluggable
public function setSlug(string $slug): self
{
$this->slugPlaceholder = $slug;

return $this;
}

public function getSlug(): ?string
{
return $this->slug;
}

Reply

Hey Mike P.!

Hmm, I don't know the answer for sure, but by the information you're giving, I think you've clearly investigated it and found out that this is probably not possible. A quick search didn't turn up any possibilities. Victor from SfCasts mentioned that this might be possible with https://github.com/KnpLabs/... - but I'm not sure.

Overall, though, it seems like if you need to generate the slug value coming completely from an external source... I'd just do it manually. The class that's responsible for transforming the string into a URL-safe string is here: https://github.com/Atlantic... - so you can use that manually to do it. You could *even* do this in a Doctrine listener, if you wanted it to be automatic.

Let me know if this makes sense! It sounds like it might be a situation where what you need is different enough that using a library is making your life *harder* instead of easier.

Cheers!

1 Reply
Mike P. Avatar

Could I ask you one more question?
For categories, do you use the Tree component of Stof Doctrine Extensions of do you do it on "your own"?
What do you suggest to implement categories inside a web project? (By example Categories for space bar articles)

Reply
Cat in space

"Houston: no signs of life"
Start the conversation!

What PHP libraries does this tutorial use?

// composer.json
{
    "require": {
        "php": "^7.1.3",
        "ext-iconv": "*",
        "composer/package-versions-deprecated": "^1.11", // 1.11.99
        "knplabs/knp-markdown-bundle": "^1.7", // 1.7.0
        "knplabs/knp-time-bundle": "^1.8", // 1.8.0
        "nexylan/slack-bundle": "^2.0,<2.2.0", // v2.0.0
        "php-http/guzzle6-adapter": "^1.1", // v1.1.1
        "sensio/framework-extra-bundle": "^5.1", // v5.1.4
        "stof/doctrine-extensions-bundle": "^1.3", // v1.3.0
        "symfony/asset": "^4.0", // v4.0.4
        "symfony/console": "^4.0", // v4.0.14
        "symfony/flex": "^1.0", // v1.17.6
        "symfony/framework-bundle": "^4.0", // v4.0.14
        "symfony/lts": "^4@dev", // dev-master
        "symfony/orm-pack": "^1.0", // v1.0.6
        "symfony/twig-bundle": "^4.0", // v4.0.4
        "symfony/web-server-bundle": "^4.0", // v4.0.4
        "symfony/yaml": "^4.0" // v4.0.14
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^3.0", // 3.0.2
        "easycorp/easy-log-handler": "^1.0.2", // v1.0.4
        "fzaninotto/faker": "^1.7", // v1.7.1
        "symfony/debug-bundle": "^3.3|^4.0", // v4.0.4
        "symfony/dotenv": "^4.0", // v4.0.14
        "symfony/maker-bundle": "^1.0", // v1.4.0
        "symfony/monolog-bundle": "^3.0", // v3.1.2
        "symfony/phpunit-bridge": "^3.3|^4.0", // v4.0.4
        "symfony/profiler-pack": "^1.0", // v1.0.3
        "symfony/var-dumper": "^3.3|^4.0" // v4.0.4
    }
}