Last active
December 10, 2015 08:08
-
-
Save sorenmalling/4406052 to your computer and use it in GitHub Desktop.
TYPO3 Flow: Extending Person for my own account
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 | |
namespace Teamwork\Teamwork\Domain\Model; | |
/* * | |
* This script belongs to the TYPO3 Flow package "Teamwork.Teamwork". * | |
* * | |
* */ | |
use TYPO3\Flow\Annotations as Flow; | |
use Doctrine\ORM\Mapping as ORM; | |
/** | |
* A Account | |
* | |
* @Flow\Entity | |
*/ | |
class Account extends \TYPO3\Party\Domain\Model\Person { | |
/** | |
* Teams | |
* | |
* @var \Doctrine\Common\Collections\ArrayCollection<\Teamwork\Teamwork\Domain\Model\Team> | |
* @ORM\ManyToMany(inversedBy="members", cascade={"all"}) | |
*/ | |
protected $teams; | |
} | |
?> |
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
An exception occurred while executing 'ALTER TABLE | |
teamwork_teamwork_domain_model_account ADD CONSTRAINT FK_8F3E8CCC47A46B0A | |
FOREIGN KEY (persistence_object_identifier) REFERENCES | |
typo3_party_domain_model_abstractparty (persistence_object_identifier) ON | |
DELETE CASCADE': | |
SQLSTATE[HY000]: General error: 1005 Can't create table | |
'teamwork.#sql-2f5_ee6' (errno: 150) |
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 | |
namespace TYPO3\Flow\Persistence\Doctrine\Migrations; | |
use Doctrine\DBAL\Migrations\AbstractMigration, | |
Doctrine\DBAL\Schema\Schema; | |
/** | |
* Auto-generated Migration: Please modify to your need! | |
*/ | |
class Version20121230185531 extends AbstractMigration { | |
/** | |
* @param Schema $schema | |
* @return void | |
*/ | |
public function up(Schema $schema) { | |
// this up() migration is autogenerated, please modify it to your needs | |
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); | |
$this->addSql("ALTER TABLE teamwork_teamwork_domain_model_account ADD CONSTRAINT FK_8F3E8CCC47A46B0A FOREIGN KEY (persistence_object_identifier) REFERENCES typo3_party_domain_model_abstractparty (persistence_object_identifier) ON DELETE CASCADE"); | |
$this->addSql("ALTER TABLE teamwork_teamwork_domain_model_account_teams_join ADD CONSTRAINT FK_9A050FB71D70B335 FOREIGN KEY (teamwork_account) REFERENCES teamwork_teamwork_domain_model_account (persistence_object_identifier)"); | |
$this->addSql("ALTER TABLE teamwork_teamwork_domain_model_account_teams_join ADD CONSTRAINT FK_9A050FB7ABA18E39 FOREIGN KEY (teamwork_team) REFERENCES teamwork_teamwork_domain_model_team (persistence_object_identifier)"); | |
} | |
/** | |
* @param Schema $schema | |
* @return void | |
*/ | |
public function down(Schema $schema) { | |
// this down() migration is autogenerated, please modify it to your needs | |
$this->abortIf($this->connection->getDatabasePlatform()->getName() != "mysql"); | |
$this->addSql("ALTER TABLE teamwork_teamwork_domain_model_account DROP FOREIGN KEY FK_8F3E8CCC47A46B0A"); | |
$this->addSql("ALTER TABLE teamwork_teamwork_domain_model_account_teams_join DROP FOREIGN KEY FK_9A050FB71D70B335"); | |
$this->addSql("ALTER TABLE teamwork_teamwork_domain_model_account_teams_join DROP FOREIGN KEY FK_9A050FB7ABA18E39"); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment