dev-master
9999999-devSingle class package to provide base getter/setter functions for Doctrine Entities
MIT
by Ross Riley
1.0.0
1.0.0.0Single class package to provide base getter/setter functions for Doctrine Entities
MIT
by Ross Riley
Single class package to provide base getter/setter functions for Doctrine Entities
This base class is designed to provide a few out of the box hooks for Entity classes., (*1)
Create your entity class and simply extend this base class. For example:, (*2)
You can now create a new entity class and pre-seed it with data., (*3)
$object = new Myentity(['option1'=>'test','option2'=>'test']);
You can get and set properties via getter and setter syntax., (*4)
$object = new Myentity(); $object->option1 = 'test'; echo $object->option1; // 'test'
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'
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'=>'']
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); } } ?>
Single class package to provide base getter/setter functions for Doctrine Entities
MIT
Single class package to provide base getter/setter functions for Doctrine Entities
MIT