Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better deletion management and cascading. Added a PageTranslation class to manage (future) translations easily. Added a "getTree()" method in the Page entity, to get the page parents' tree with a string separator (used to generate urls)
- Loading branch information
1 parent
879a343
commit 63650be
Showing
4 changed files
with
177 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?php | ||
/* | ||
* This file is part of the PierstovalCmsBundle package. | ||
* | ||
* (c) Alexandre "Pierstoval" Rock Ancelet <pierstoval@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Pierstoval\Bundle\CmsBundle\Entity; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
use Gedmo\Translatable\Entity\MappedSuperclass\AbstractPersonalTranslation; | ||
|
||
/** | ||
* @ORM\Entity | ||
* @ORM\Table(name="pierstoval_cms_pages_translations", | ||
* uniqueConstraints={ | ||
* @ORM\UniqueConstraint(name="lookup_unique_idx", columns={ | ||
* "locale", "object_id", "field" | ||
* }) | ||
* } | ||
* ) | ||
*/ | ||
class PageTranslation extends AbstractPersonalTranslation | ||
{ | ||
|
||
/** | ||
* Convenient 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="Page", inversedBy="translations") | ||
* @ORM\JoinColumn(name="object_id", referencedColumnName="id", onDelete="CASCADE") | ||
*/ | ||
protected $object; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters