Last active
August 29, 2015 14:11
-
-
Save guiwoda/629e6e9f883c6659b6bd to your computer and use it in GitHub Desktop.
Embeddables with inheritance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
abstract class Framework { | |
/** | |
* @type bool | |
*/ | |
private $installsGlobally; | |
abstract public function download(); | |
} | |
class Symfony extends Framework { | |
public function download() { | |
return 'git clone [email protected]:symfony/symfony.git'; | |
} | |
} | |
class Phalcon extends Framework { | |
public function download() { | |
return 'pear install phalcon'; // idk | |
} | |
} | |
class Project { | |
/** | |
* @type Framework | |
*/ | |
private $framework; | |
/** | |
* @type string | |
*/ | |
private $name; | |
/** | |
* @type User | |
*/ | |
private $owner; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Framework: | |
type: embeddable | |
fields: | |
installsGlobally: { type: boolean } | |
inheritanceType: SINGLE_TABLE | |
discriminatorColumn: | |
name: discr | |
type: string | |
discriminatorMap: | |
symfony: Symfony | |
phalcon: Phalcon | |
Project: | |
embedded: | |
framework: | |
class: ??? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It's a silly example, but I guess the point is clear: Allow inheritance of embeddable types.