-
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.
Merge pull request #42 from mishak87/feature_interface
Feature interface WIP
- Loading branch information
Showing
6 changed files
with
177 additions
and
10 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 ([email protected]) | ||
* | ||
* 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 <[email protected]> | ||
*/ | ||
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 ([email protected]) | ||
* | ||
* 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 <[email protected]> | ||
*/ | ||
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 ([email protected]) | ||
* | ||
* 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 <[email protected]> | ||
*/ | ||
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 ); | ||
} | ||
|
||
} |