2017 © Pedro Peláez
 

library embeddable-constant

EmbeddableConstant module for zend framework 3

image

vim/embeddable-constant

EmbeddableConstant module for zend framework 3

  • Friday, January 19, 2018
  • by vanvas
  • Repository
  • 1 Watchers
  • 0 Stars
  • 5 Installations
  • PHP
  • 1 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

embeddable-constant

Module for Zend Framework 3., (*1)

Installation

Installation of this module uses composer. For composer documentation, please refer to getcomposer.org., (*2)

composer require vim/embeddable-constant

Example

<?php
namespace Application\Entity;

use Doctrine\ORM\Mapping as ORM;
use Application\Entity\EmbeddableConstant\SomeEntityStatusEmbeddableConstant;

/**
 * @ORM\Table
 * @ORM\Entity
 */
class SomeEntity
{
    /**
     * @var integer
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $identity;

    /**
     * @var SomeEntityStatusEmbeddableConstant
     * @ORM\Embedded(class="Application\Entity\EmbeddableConstant\SomeEntityStatusEmbeddableConstant", columnPrefix = false)
     */
    public $status;

    public function __construct()
    {
        $this->status = new SomeEntityStatusEmbeddableConstant(SomeEntityStatusEmbeddableConstant::ACTIVE);
    }

    /**
     * @return int
     */
    public function getIdentity(): int
    {
        return $this->identity;
    }
}
<?php

namespace Application\Entity\EmbeddableConstant;

use Doctrine\ORM\Mapping as ORM;
use Vim\EmbeddableConstant\EmbeddableConstantAbstract;

/**
 * @ORM\Embeddable
 */
class SomeEntityStatusEmbeddableConstant extends EmbeddableConstantAbstract
{
    const ACTIVE = 'active';

    const BLOCKED = 'blocked';

    /**
     * @var string
     * @ORM\Column(name="status", type="string", length=10, nullable=false)
     */
    protected $value;

    /**
     * @return bool
     */
    public function isActive()
    {
        return $this->value === self::ACTIVE;
    }

    /**
     * @return bool
     */
    public function isBlocked()
    {
        return $this->value === self::BLOCKED;
    }
}

The Versions

19/01 2018

dev-master

9999999-dev https://github.com/vanvas/embeddable-constant.git

EmbeddableConstant module for zend framework 3

  Sources   Download

The Requires

  • php >=7.0

 

php zend framework zf3 module embeddable constant

19/01 2018

1.0.0

1.0.0.0 https://github.com/vanvas/embeddable-constant.git

EmbeddableConstant module for zend framework 3

  Sources   Download

The Requires

  • php >=7.0

 

php zend framework zf3 module embeddable constant