-
-
Notifications
You must be signed in to change notification settings - Fork 67
Proposals JobCategories
Mathias Gelhausen edited this page Nov 23, 2016
·
3 revisions
We want to be able to let an organization owner define custom job classification categories which then can be applied to any job associated with that organization.
For example a category tree for professions
- IT
- Software development
- Software architecture
- Management
- Project manager
- Team leader
or a flat hierarchy for employment types
- full time
- part time
- freelancer
These categories
- should be hierarchically, but may be organized in just one level.
- should be attached to an organization entity.
-
should be able to be assigned to a job entity.
And it should be configurable whether only one or multiple items of one category can be assigned. - should be fully customizable via web front-end (in "edit my organization" view)
- should be indexable by a search engine, to enable p.e facets search.
- Categories entities which will be used to manage the available categories (and items) for an organization as well as attach categories to a job entity.
- Form elements to create and manage categories which can be used in form containers (such as "edit organization")
- Form elements to assign categories to an entity (such as a job entity via injection to the job form container)
Only key aspects are outlined, so most setters and other obvious code are omitted for simplicity.
interface CategoryInterface extends IdentifiableEntityInterface
{
const TYPE_SINGLE = 'single';
const TYPE_MULTIPLE = 'multiple';
public function getName();
public function getItems();
public function getType();
public function isMultiple();
public function isSingle();
}
/**
* @ODM\Document
*/
class Category implements CategoryInterface
{
private $name;
/**
* @var Collection
*/
private $items;
}
interface CategoryItemInterface extends EntityInterface
{
public function getName();
public function getValue();
public function getChildren();
public function hasChildren();
public function getPriority();
}
/**
* @ODM\EmbeddedDocument
*/
class CategoryItem implements CategoryItemInterface
{
private $name;
/**
* @ODM\EmbedMany(targetDocument="CategoryItem")
*/
private $children;
private $value;
private $priority;
}
interface AttachedCategoryInterface extends EntityInterface
{
public function getName();
public function getItems();
}
class AttachedCategory
{
private $name;
private $items;
}
/* CODE */
// flat hierarchy
$types = new Category('Employment Types');
$types
->getItems()
->add(new CategoryItem(/*name*/ 'Full time', /*value*/ 'full-time', /*priority*/ 1))
->add(new CategoryItem('Part time', 'part-time', 2))
;
// tree
$professions = new Category('Professions');
$profIt = new CategoryItem('It', 'it', 1);
$profIt
->getChildren()
->add(new CategoryItem('Software development', 'software-development', 1))
->add(new CategoryItem('Software architecture', 'software-architecture', 2))
;
$profManager = new CategoryItem('Manager', 'manager', 2);
$professions
->getItems()
->add($profIt)
->add($profManager)
;
// attach
$job = new Job();
$attachedProfessions = new AttachedCategory('Profession');
$attachedProfessions
->getItems()
->add($profIt->getItems()->get('software-development'))
;
$job->addAttachedEntity($attachedProfessions, 'categories-professions');