-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for ResolverTargetEntityMappingListener
- Loading branch information
1 parent
9097b56
commit 54d787f
Showing
6 changed files
with
173 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Kdyby (http://www.kdyby.org) | ||
* | ||
* Copyright (c) 2008 Filip Procházka (filip@prochazka.su) | ||
* | ||
* For the full copyright and license information, please view the file license.txt that was distributed with this source code. | ||
*/ | ||
|
||
namespace Kdyby\Doctrine; | ||
|
||
use Doctrine; | ||
use Doctrine\ORM\Configuration as BaseConfiguration; | ||
use Kdyby; | ||
use Nette; | ||
|
||
|
||
|
||
/** | ||
* @author Michal Gebauer <mishak@mishak.net> | ||
*/ | ||
class Configuration extends BaseConfiguration | ||
{ | ||
|
||
public function setTargetEntityMap($targetEntityMap) | ||
{ | ||
$this->_attributes['targetEntityMap'] = $targetEntityMap; | ||
} | ||
|
||
|
||
|
||
public function getTargetEntityClassName($className) | ||
{ | ||
return isset($this->_attributes['targetEntityMap'], $this->_attributes['targetEntityMap'][$className]) | ||
? $this->_attributes['targetEntityMap'][$className] | ||
: $className; | ||
} | ||
|
||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Kdyby (http://www.kdyby.org) | ||
* | ||
* Copyright (c) 2008 Filip Procházka (filip@prochazka.su) | ||
* | ||
* For the full copyright and license information, please view the file license.txt that was distributed with this source code. | ||
*/ | ||
|
||
namespace Kdyby\Doctrine\DI; | ||
|
||
use Kdyby; | ||
use Nette; | ||
|
||
|
||
|
||
/** | ||
* Mapping definition can be array of | ||
* - originalEntity => targetEntity | ||
* - originalEntity => [ targetEntity => <class>, ... additional mapping data ] | ||
* | ||
* @author Michal Gebauer <mishak@mishak.net> | ||
*/ | ||
interface ITargetEntityProvider | ||
{ | ||
|
||
/** | ||
* Returns associative array of Interface => Class definition | ||
* | ||
* @return array | ||
*/ | ||
function getTargetEntityMappings(); | ||
|
||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of the Kdyby (http://www.kdyby.org) | ||
* | ||
* Copyright (c) 2008 Filip Procházka (filip@prochazka.su) | ||
* | ||
* For the full copyright and license information, please view the file license.txt that was distributed with this source code. | ||
*/ | ||
|
||
namespace Kdyby\Doctrine\Tools; | ||
|
||
use Doctrine; | ||
use Kdyby; | ||
|
||
|
||
|
||
/** | ||
* @author Michal Gebauer <mishak@mishak.net> | ||
*/ | ||
class ResolveTargetEntityListener extends Doctrine\ORM\Tools\ResolveTargetEntityListener implements Kdyby\Events\Subscriber | ||
{ | ||
|
||
/** | ||
* Returns an array of events this subscriber wants to listen to. | ||
* | ||
* @return array | ||
*/ | ||
public function getSubscribedEvents() | ||
{ | ||
return array( Doctrine\ORM\Events::loadClassMetadata ); | ||
} | ||
|
||
} |