Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
sluggable not working
  • Loading branch information
napestershine committed Feb 24, 2019
1 parent c0d30de commit 857acc2
Show file tree
Hide file tree
Showing 7 changed files with 252 additions and 2 deletions.
1 change: 1 addition & 0 deletions composer.json
Expand Up @@ -10,6 +10,7 @@
"nexylan/slack-bundle": "^2.1",
"php-http/guzzle6-adapter": "1.1.1",
"sensio/framework-extra-bundle": "^5.2",
"stof/doctrine-extensions-bundle": "^1.3",
"symfony/asset": "4.2.*",
"symfony/console": "4.2.*",
"symfony/dotenv": "4.2.*",
Expand Down
192 changes: 191 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions config/bundles.php
Expand Up @@ -19,4 +19,5 @@
Nexy\SlackBundle\NexySlackBundle::class => ['all' => true],
Knp\Bundle\TimeBundle\KnpTimeBundle::class => ['all' => true],
Doctrine\Bundle\FixturesBundle\DoctrineFixturesBundle::class => ['dev' => true, 'test' => true],
Stof\DoctrineExtensionsBundle\StofDoctrineExtensionsBundle::class => ['all' => true],
];
7 changes: 7 additions & 0 deletions config/packages/stof_doctrine_extensions.yaml
@@ -0,0 +1,7 @@
# 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
1 change: 0 additions & 1 deletion src/DataFixtures/ArticleFixtures.php
Expand Up @@ -31,7 +31,6 @@ protected function loadData(ObjectManager $manager)
$this->createMany(Article::class, 10, function (Article $article, $count) {

$article->setTitle($this->faker->randomElement(self::$articleTitles))
->setSlug($this->faker->slug)
->setContent(
<<<EOF
Spicy **jalapeno** bacon ipsum dolor amet veniam shank in dolore. Ham hock nisi landjaeger cow, lorem proident [beef ribs](https://baconipsum.com/) aute enim veniam ut cillum pork chuck picanha. Dolore reprehenderit labore minim pork belly spare ribs cupim short loin in. Elit exercitation eiusmod dolore cow **turkey** shank eu pork belly meatball non cupim.
Expand Down
37 changes: 37 additions & 0 deletions src/Entity/Article.php
Expand Up @@ -3,6 +3,7 @@
namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;

/**
* @ORM\Entity(repositoryClass="App\Repository\ArticleRepository")
Expand All @@ -22,7 +23,9 @@ class Article
private $title;

/**
*
* @ORM\Column(type="string", length=100, unique=true)
* @Gedmo\Slug(fields={"title"})
*/
private $slug;

Expand Down Expand Up @@ -51,6 +54,16 @@ class Article
*/
private $imageFilename;

/**
* @ORM\Column(type="datetime")
*/
private $createdAt;

/**
* @ORM\Column(type="datetime")
*/
private $updatedAt;

public function getId(): ?int
{
return $this->id;
Expand Down Expand Up @@ -150,4 +163,28 @@ public function incrementHeartCount(): self
$this->heartCount = $this->getHeartCount() + 1;
return $this;
}

public function getCreatedAt(): ?\DateTimeInterface
{
return $this->createdAt;
}

public function setCreatedAt(\DateTimeInterface $createdAt): self
{
$this->createdAt = $createdAt;

return $this;
}

public function getUpdatedAt(): ?\DateTimeInterface
{
return $this->updatedAt;
}

public function setUpdatedAt(\DateTimeInterface $updatedAt): self
{
$this->updatedAt = $updatedAt;

return $this;
}
}
15 changes: 15 additions & 0 deletions symfony.lock
@@ -1,4 +1,7 @@
{
"behat/transliterator": {
"version": "v1.2.0"
},
"clue/stream-filter": {
"version": "v1.4.0"
},
Expand Down Expand Up @@ -104,6 +107,9 @@
"fzaninotto/faker": {
"version": "v1.8.0"
},
"gedmo/doctrine-extensions": {
"version": "v2.4.36"
},
"guzzlehttp/guzzle": {
"version": "6.3.3"
},
Expand Down Expand Up @@ -227,6 +233,15 @@
"ref": "05daf6b214e54aed4089f3480f944a67ac3a7889"
}
},
"stof/doctrine-extensions-bundle": {
"version": "1.2",
"recipe": {
"repo": "github.com/symfony/recipes-contrib",
"branch": "master",
"version": "1.2",
"ref": "6c1ceb662f8997085f739cd089bfbef67f245983"
}
},
"swiftmailer/swiftmailer": {
"version": "v6.1.3"
},
Expand Down

0 comments on commit 857acc2

Please sign in to comment.