2017 © Pedro PelĂĄez
 

library seo

A library base for seo entities for PositibeLabs Project

image

positibe/seo

A library base for seo entities for PositibeLabs Project

  • Tuesday, April 11, 2017
  • by pcabreus
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Positibe Publishable Component

This library provide you some traits to be used in doctrine entities that implement Symfony\Cmf\Bundle\SeoBundle\SeoAwareInterface., (*1)

SeoAwareEntityTrait

This trait has the default mapping for a Entity that has a association with SeoMetadata Entity., (*2)

[php]
<?php

namespace Positibe\Component\Seo\Entity;

use Symfony\Cmf\Bundle\SeoBundle\Model\SeoMetadata;

trait SeoAwareEntityTrait {
    /**
     * @var SeoMetadata
     *
     * @ORM\ManyToOne(targetEntity="Symfony\Cmf\Bundle\SeoBundle\Model\SeoMetadata", cascade="all")
     */
    protected $seoMetadata;

    /**
     * @return SeoMetadata
     */
    public function getSeoMetadata()
    {
        return $this->seoMetadata;
    }

    /**
     * @param $metadata
     * @return $this
     */
    public function setSeoMetadata($metadata)
    {
        $this->seoMetadata = $metadata;

        return $this;
    }
}

PublishTimePeriodTrait

This trait has the default mapping for a Entity that store all data of SeoMetadata in a Doctrine Object., (*3)

[php]
<?php

namespace Positibe\Component\Seo\Entity;

use Symfony\Cmf\Bundle\SeoBundle\Model\SeoMetadata;

trait SeoAwareObjectTrait {

    /**
     * @var SeoMetadata
     *
     * @ORM\Column(type="object")
     */
    protected $seoMetadata;

    /**
     * @return SeoMetadata
     */
    public function getSeoMetadata()
    {
        return $this->seoMetadata;
    }

    /**
     * @param $metadata
     * @return $this
     */
    public function setSeoMetadata($metadata)
    {
        $this->seoMetadata = $metadata;

        return $this;
    }
}

Using php trait

These are simple php traits so you can use it like that., (*4)

[php]
namespace Blog\Entity;

use Symfony\Cmf\Bundle\SeoBundle\SeoAwareInterface;
use Positibe\Component\Seo\Entity\SeoAwareEntityTrait;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Table()
 * @ORM\Entity
 */
class Post implement SeoAwareInterface
{
    use SeoAwareEntityTrait;

    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;
}

Note how you don't need to create anything to implement those interfaces., (*5)

Caution: To use the trait system you need to use PHP > 5.4., (*6)

The Versions

11/04 2017

dev-master

9999999-dev http://positibelabs.blogspot.com/component/seo

A library base for seo entities for PositibeLabs Project

  Sources   Download

MIT

seo positibelabs positibe

11/04 2017

0.1.4.0

0.1.4.0 http://positibelabs.blogspot.com/component/seo

A library base for seo entities for PositibeLabs Project

  Sources   Download

MIT

seo positibelabs positibe

05/04 2017

0.1.3.0

0.1.3.0 http://positibelabs.blogspot.com/component/seo

A library base for seo entities for PositibeLabs Project

  Sources   Download

MIT

seo positibelabs positibe