2017 © Pedro Peláez
 

library puja-entity

Puja-Entity is an abstract layer to manage a entity object and easy to get the Docblock document

image

jinnguyen/puja-entity

Puja-Entity is an abstract layer to manage a entity object and easy to get the Docblock document

  • Sunday, December 18, 2016
  • by jinnguyen
  • Repository
  • 1 Watchers
  • 0 Stars
  • 49 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

puja-entity

Puja-Entity is an abstract layer to manage a entity object and easy to get the Docblock document, (*1)

Install, (*2)

composer required jinnguyen/puja-entity

Usage, (*3)

include '/path/to/vendor/autoload.php';
use Puja\Entity\Entity;

Examples, (*4)

/**
 * This comment is copied from ContentEntity->getDocblock(); you should do it each time you change the ContentEntity->attributes
 * @method int getId()
 * @method setId(int $attr)
 * @method hasId()
 * @method unsetId()
 * @method string getName()
 * @method setName(string $attr)
 * @method hasName()
 * @method unsetName()
 * @method string getCreatedAt()
 * @method setCreatedAt(string $attr)
 * @method hasCreatedAt()
 * @method unsetCreatedAt()
 * @method string getCreatedAt()
 * @method setCreatedAt(string $attr)
 * @method hasCreatedAt()
 * @method unsetCreatedAt()
 * @method Category getCategory()
 * @method setCategory(Category $attr)
 * @method hasCategory()
 * @method unsetCategory()
 */
class ContentEntity extends Entity
{
    protected $attributes = array(
        'id' => Entity::DATATYPE_INT,
        'name' => Entity::DATATYPE_STRING,
        'created_at' => Entity::DATATYPE_STRING,
        'price' => Entity::DATATYPE_INT,
        'category' => 'Category',
    );
    protected $defaults = array(
        'price' => 5,
    );
}

class Category
{
    public $id = 1;
    public $name = 'Category 1';
}

$content = new ContentEntity(array(
    'id' => 1,
    'name' => 'Content 1',
    'created_at' => '2016-11-18 00:00:00',
    'category' => new Category()
));

echo $content->getId(); // 1
echo $content->getName(); // Content 1
echo $content->getCreatedAt(); // 2016-11-18 00:00:00
echo $content->getId(); // 5

$category = $content->getCategory();
echo $category->name; // Category 1
echo $content->getDocblock(); // The dockbock content is used above class ContentEntity

Note: ContentEntity is Entity, but Category is not., (*5)

The Versions

18/12 2016

dev-master

9999999-dev

Puja-Entity is an abstract layer to manage a entity object and easy to get the Docblock document

  Sources   Download

Apache License 2.0

The Requires

  • php >=5.3

 

by Jin Nguyen

entity puja

18/12 2016

v1.3.1

1.3.1.0

Puja-Entity is an abstract layer to manage a entity object and easy to get the Docblock document

  Sources   Download

Apache License 2.0

The Requires

  • php >=5.3

 

by Jin Nguyen

entity puja

18/11 2016

v1.0.0

1.0.0.0

Puja-Entity is an abstract layer to manage a entity object and easy to get the Docblock document

  Sources   Download

Apache License 2.0

The Requires

  • php >=5.3

 

by Jin Nguyen

entity puja