GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - kore/DataObject: Simple base class for data objects.

BranchesTags
Open more actions menu

Latest commit

 

History

27 Commits
27 Commits

Folders and files

NameName
Last commit message
Last commit date
ant @ 6eebd0d
ant @ 6eebd0d
 
 
src/Kore/DataObject
src/Kore/DataObject
 
 
tests/Kore/DataObject
tests/Kore/DataObject
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
.travis.yml
.travis.yml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.properties
build.properties
 
 
build.xml
build.xml
 
 
composer.json
composer.json
 
 
composer.lock
composer.lock
 
 
phpunit.xml
phpunit.xml
 
 

Repository files navigation

Data Object

Travis Build Status

This repository just contains a simple base class for PHP data objects.

This class throws exceptions if you try to read or write unknown properties, and ensures a clone is performed recursively.

Usage

To use this data object base class for your own data objects, just use something like this:

class Person extends \Kore\DataObject\DataObject
{
    public $prename;

    public $forename;
}

If you now access unknown properties you will get exceptions. For more details on the motivation behind this, read: http://qafoo.com/blog/016_struct_classes_in_php.html

In some cases it might be necessary that additional attributes can be passed while construction and are knowingly ignored and not added to the DataObject. Therefore a constructor parameter $ignoreAdditionalAttributes has been added, which is set to false by default, but could be set to true in the rare cases when needed. This will allow to create a DataObject of an array with more values where the additional values will be ignored and no exception will be thrown during construction. If you later try to access a property which is not existing though, an exception will be raised!

About

Simple base class for data objects.

Resources

Readme
License
Activity

Stars

11 stars

Watchers

1 watching

Forks

4 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.