2017 © Pedro Peláez
 

library doctrine-entity-base

Single class package to provide base getter/setter functions for Doctrine Entities

image

rossriley/doctrine-entity-base

Single class package to provide base getter/setter functions for Doctrine Entities

  • Monday, November 17, 2014
  • by rossriley
  • Repository
  • 1 Watchers
  • 1 Stars
  • 1,147 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Doctrine Entity Base Class

This base class is designed to provide a few out of the box hooks for Entity classes., (*1)

Extending

Create your entity class and simply extend this base class. For example:, (*2)


Constructing with data

You can now create a new entity class and pre-seed it with data., (*3)

$object = new Myentity(['option1'=>'test','option2'=>'test']);

Property getters and setters

You can get and set properties via getter and setter syntax., (*4)

$object = new Myentity();
$object->option1 = 'test';
echo $object->option1; // 'test'

Support for method getters and setters

If you'd prefer to use methods to get and set, this works the same:, (*5)

$object = new Myentity();
$object->setOption1('test');
echo $object->getOption1(); // 'test'

Serialize

You can quickly serialize your entity object by calling the serialize() method., (*6)

$object = new Myentity();
$object->setOption1('test');
print_r($object->serialize()); // ['option1'=>'test', 'option2'=>'']

Providing your own methods.

If you want to override the default behaviour for any of the properties on your object then you can do so by supplying your own methods. These will always be used ahead of the fallback behaviour., (*7)

option1 = json_encode($val);
    }
    
    public function getOption1()
    {
        return json_decode($val);
    }
    
    public function serializeOption1()
    {
        return json_decode($val);
    }
    
}

?>

The Versions

17/11 2014

dev-master

9999999-dev

Single class package to provide base getter/setter functions for Doctrine Entities

  Sources   Download

MIT

17/11 2014

1.0.0

1.0.0.0

Single class package to provide base getter/setter functions for Doctrine Entities

  Sources   Download

MIT