init without trunk
This commit is contained in:
parent
ed24ac4994
commit
bb809e7233
14652 changed files with 177862 additions and 94817 deletions
219
vendor/gedmo/doctrine-extensions/example/app/Entity/Category.php
vendored
Normal file
219
vendor/gedmo/doctrine-extensions/example/app/Entity/Category.php
vendored
Normal file
|
|
@ -0,0 +1,219 @@
|
|||
<?php
|
||||
namespace Entity;
|
||||
|
||||
use Doctrine\Common\Collections\ArrayCollection;
|
||||
use Gedmo\Mapping\Annotation as Gedmo;
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
/**
|
||||
* @Gedmo\Tree(type="nested")
|
||||
* @ORM\Table(name="ext_categories")
|
||||
* @ORM\Entity(repositoryClass="Entity\Repository\CategoryRepository")
|
||||
* @Gedmo\TranslationEntity(class="Entity\CategoryTranslation")
|
||||
*/
|
||||
class Category
|
||||
{
|
||||
/**
|
||||
* @ORM\Column(type="integer")
|
||||
* @ORM\Id
|
||||
* @ORM\GeneratedValue
|
||||
*/
|
||||
private $id;
|
||||
|
||||
/**
|
||||
* @Gedmo\Translatable
|
||||
* @ORM\Column(length=64)
|
||||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* @Gedmo\Translatable
|
||||
* @ORM\Column(type="text", nullable=true)
|
||||
*/
|
||||
private $description;
|
||||
|
||||
/**
|
||||
* @Gedmo\Translatable
|
||||
* @Gedmo\Slug(fields={"created", "title"})
|
||||
* @ORM\Column(length=64, unique=true)
|
||||
*/
|
||||
private $slug;
|
||||
|
||||
/**
|
||||
* @Gedmo\TreeLeft
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $lft;
|
||||
|
||||
/**
|
||||
* @Gedmo\TreeRight
|
||||
* @ORM\Column(type="integer")
|
||||
*/
|
||||
private $rgt;
|
||||
|
||||
/**
|
||||
* @Gedmo\TreeParent
|
||||
* @ORM\ManyToOne(targetEntity="Category", inversedBy="children")
|
||||
* @ORM\JoinColumn(name="parent_id", referencedColumnName="id", onDelete="CASCADE")
|
||||
*/
|
||||
private $parent;
|
||||
|
||||
/**
|
||||
* @Gedmo\TreeRoot
|
||||
* @ORM\Column(type="integer", nullable=true)
|
||||
*/
|
||||
private $root;
|
||||
|
||||
/**
|
||||
* @Gedmo\TreeLevel
|
||||
* @ORM\Column(name="lvl", type="integer")
|
||||
*/
|
||||
private $level;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(targetEntity="Category", mappedBy="parent")
|
||||
*/
|
||||
private $children;
|
||||
|
||||
/**
|
||||
* @Gedmo\Timestampable(on="create")
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
private $created;
|
||||
|
||||
/**
|
||||
* @Gedmo\Timestampable(on="update")
|
||||
* @ORM\Column(type="datetime")
|
||||
*/
|
||||
private $updated;
|
||||
|
||||
/**
|
||||
* @Gedmo\Blameable(on="create")
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
private $createdBy;
|
||||
|
||||
/**
|
||||
* @Gedmo\Blameable(on="update")
|
||||
* @ORM\Column(type="string")
|
||||
*/
|
||||
private $updatedBy;
|
||||
|
||||
/**
|
||||
* @ORM\OneToMany(
|
||||
* targetEntity="CategoryTranslation",
|
||||
* mappedBy="object",
|
||||
* cascade={"persist", "remove"}
|
||||
* )
|
||||
*/
|
||||
private $translations;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->children = new ArrayCollection();
|
||||
$this->translations = new ArrayCollection();
|
||||
}
|
||||
|
||||
public function getTranslations()
|
||||
{
|
||||
return $this->translations;
|
||||
}
|
||||
|
||||
public function addTranslation(CategoryTranslation $t)
|
||||
{
|
||||
if (!$this->translations->contains($t)) {
|
||||
$this->translations[] = $t;
|
||||
$t->setObject($this);
|
||||
}
|
||||
}
|
||||
|
||||
public function getSlug()
|
||||
{
|
||||
return $this->slug;
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
public function setTitle($title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
public function setDescription($description)
|
||||
{
|
||||
$this->description = $description;
|
||||
}
|
||||
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
|
||||
public function setParent($parent)
|
||||
{
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
public function getRoot()
|
||||
{
|
||||
return $this->root;
|
||||
}
|
||||
|
||||
public function getLevel()
|
||||
{
|
||||
return $this->level;
|
||||
}
|
||||
|
||||
public function getChildren()
|
||||
{
|
||||
return $this->children;
|
||||
}
|
||||
|
||||
public function getLeft()
|
||||
{
|
||||
return $this->lft;
|
||||
}
|
||||
|
||||
public function getRight()
|
||||
{
|
||||
return $this->rgt;
|
||||
}
|
||||
|
||||
public function getCreated()
|
||||
{
|
||||
return $this->created;
|
||||
}
|
||||
|
||||
public function getUpdated()
|
||||
{
|
||||
return $this->updated;
|
||||
}
|
||||
|
||||
public function getCreatedBy()
|
||||
{
|
||||
return $this->createdBy;
|
||||
}
|
||||
|
||||
public function getUpdatedBy()
|
||||
{
|
||||
return $this->updatedBy;
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getTitle();
|
||||
}
|
||||
}
|
||||
37
vendor/gedmo/doctrine-extensions/example/app/Entity/CategoryTranslation.php
vendored
Normal file
37
vendor/gedmo/doctrine-extensions/example/app/Entity/CategoryTranslation.php
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Entity;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
use Gedmo\Translatable\Entity\MappedSuperclass\AbstractPersonalTranslation;
|
||||
|
||||
/**
|
||||
* @ORM\Entity
|
||||
* @ORM\Table(name="category_translations",
|
||||
* uniqueConstraints={@ORM\UniqueConstraint(name="lookup_unique_idx", columns={
|
||||
* "locale", "object_id", "field"
|
||||
* })}
|
||||
* )
|
||||
*/
|
||||
class CategoryTranslation extends AbstractPersonalTranslation
|
||||
{
|
||||
/**
|
||||
* Convinient constructor
|
||||
*
|
||||
* @param string $locale
|
||||
* @param string $field
|
||||
* @param string $value
|
||||
*/
|
||||
public function __construct($locale, $field, $value)
|
||||
{
|
||||
$this->setLocale($locale);
|
||||
$this->setField($field);
|
||||
$this->setContent($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @ORM\ManyToOne(targetEntity="Category", inversedBy="translations")
|
||||
* @ORM\JoinColumn(name="object_id", referencedColumnName="id", onDelete="CASCADE")
|
||||
*/
|
||||
protected $object;
|
||||
}
|
||||
9
vendor/gedmo/doctrine-extensions/example/app/Entity/Repository/CategoryRepository.php
vendored
Normal file
9
vendor/gedmo/doctrine-extensions/example/app/Entity/Repository/CategoryRepository.php
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
<?php
|
||||
|
||||
namespace Entity\Repository;
|
||||
|
||||
use Gedmo\Tree\Entity\Repository\NestedTreeRepository;
|
||||
|
||||
class CategoryRepository extends NestedTreeRepository
|
||||
{
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue