Skip to content
This repository has been archived by the owner on Nov 13, 2020. It is now read-only.

first step on tags #68

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,27 @@ git push heroku my-local-branch:master # push

This app is setup to automatically deploy the `master` branch on the prod system, using Travis CI. The setup is using the file `deploy.sh` that is triggering all the needed actions (`git checkout` then `composer install`).

## Git flow

Run:
```
git flow init
```
to init the git flow setup

Run:
```
git flow feature start name-of-the-freature
```
to start a feature (choose the name you want, it will create a corresponding branch)

Do you commit / push on the branch:
```
git add .
git commit -m "first step on freature x"
git push
```

## Licence

This project is licensed under the MIT License - see the LICENSE.md file for details
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"doctrine/doctrine-fixtures-bundle": "^3.1",
"fzaninotto/faker": "^1.8",
"symfony/debug-pack": "*",
"symfony/maker-bundle": "^1.11",
"symfony/maker-bundle": "^1.13",
"symfony/profiler-pack": "*",
"symfony/test-pack": "*",
"symfony/web-server-bundle": "4.3.*"
Expand Down
18 changes: 10 additions & 8 deletions composer.lock

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

39 changes: 38 additions & 1 deletion src/Entity/Nomenclature.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ class Nomenclature
*/
private $status;

/**
* @ORM\OneToMany(targetEntity="App\Entity\Tags", mappedBy="nomenclature")
*/
private $tags;

public function __toString()
{
return $this->getName();
Expand All @@ -98,7 +103,8 @@ public function __construct() {
$this->createdAt = new \DateTime('now');
$this->cards = new ArrayCollection();
$this->pictureSet = new ArrayCollection();
$this->status = 0; // draft
$this->status = 0;
$this->tags = new ArrayCollection(); // draft
}

public function __clone() {
Expand Down Expand Up @@ -245,4 +251,35 @@ public function setStatus(int $status): self

return $this;
}

/**
* @return Collection|Tags[]
*/
public function getTags(): Collection
{
return $this->tags;
}

public function addTag(Tags $tag): self
{
if (!$this->tags->contains($tag)) {
$this->tags[] = $tag;
$tag->setNomenclature($this);
}

return $this;
}

public function removeTag(Tags $tag): self
{
if ($this->tags->contains($tag)) {
$this->tags->removeElement($tag);
// set the owning side to null (unless already changed)
if ($tag->getNomenclature() === $this) {
$tag->setNomenclature(null);
}
}

return $this;
}
}
58 changes: 58 additions & 0 deletions src/Entity/Tags.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
* @ORM\Entity(repositoryClass="App\Repository\TagsRepository")
*/
class Tags
Copy link
Member

Choose a reason for hiding this comment

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

must be Tag instead of Tags:smile

{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;

/**
* @ORM\Column(type="string", length=255)
*/
private $title;

/**
* @ORM\ManyToOne(targetEntity="App\Entity\Nomenclature", inversedBy="tags")
* @ORM\JoinColumn(nullable=false)
*/
private $nomenclature;

public function getId(): ?int
{
return $this->id;
}

public function getTitle(): ?string
{
return $this->title;
}

public function setTitle(string $title): self
{
$this->title = $title;

return $this;
}

public function getNomenclature(): ?Nomenclature
{
return $this->nomenclature;
}

public function setNomenclature(?Nomenclature $nomenclature): self
{
$this->nomenclature = $nomenclature;

return $this;
}
}
Loading