Created
January 19, 2011 19:11
-
-
Save loicfrering/786657 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
/** @Service */ | |
class ItemRepository extends LoSo_Doctrine_ORM_Tools_Dao_GenericDao | |
{ | |
$this->entityName = 'Application_Model_User'; | |
// Particular finder implemented with a DQL query | |
public function findByCategory($category) | |
{ | |
$q = $this->createQueryBuilder('i') | |
->where(':category MEMBER OF i.categories') | |
->getQuery(); | |
return $q->execute(array('category' => $category)); | |
} | |
} |
This file contains hidden or 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 | |
/** @Service */ | |
class OrderService | |
{ | |
/** @Inject */ | |
private $userRepository; | |
public function setUserRepository($userRepository) | |
{ | |
$this->userRepository = $userRepository; | |
return $this; | |
} | |
/** @Inject */ | |
private $itemRepository; | |
public function setItemRepository($itemRepository) | |
{ | |
$this->itemRepository = $itemRepository; | |
return $this; | |
} | |
/** | |
* Add business methods which may use the two injected | |
* repositories and manage transactions. | |
*/ | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment