-
Notifications
You must be signed in to change notification settings - Fork 2
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 #20 from williamespindola/fix/extension-field-depe…
…ndency-methods Fix/extension field dependency methods
- Loading branch information
Showing
26 changed files
with
530 additions
and
119 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
build | ||
composer.lock | ||
docs | ||
vendor | ||
vendor |
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
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 was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
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
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,56 @@ | ||
<?php | ||
|
||
namespace WilliamEspindola\Field\Service; | ||
|
||
use WilliamEspindola\Field\Repository\RepositoryInterface; | ||
|
||
/** | ||
* Class DoctrineFieldService | ||
* @package WilliamEspindola\Field\Service | ||
*/ | ||
class DoctrineFieldService | ||
{ | ||
/** | ||
* @var \WilliamEspindola\Field\Repository\RepositoryInterface | ||
*/ | ||
protected $repository; | ||
|
||
/** | ||
* @param RepositoryInterface $repository | ||
*/ | ||
public function __construct(RepositoryInterface $repository) | ||
{ | ||
$this->repository = $repository; | ||
} | ||
|
||
/** | ||
* @param String $name | ||
* @return Object WilliamEspindola\Field\Entity\Field | ||
*/ | ||
public function findOneByName($name) | ||
{ | ||
$field = $this->repository->findBy( | ||
['name' => $name], | ||
[['name' => 'ASC'], null, null] | ||
); | ||
|
||
return $field ? $field[0] : false; | ||
} | ||
|
||
/** | ||
* @param String $name | ||
* @return String Value of field | ||
*/ | ||
public function findOneByNameAndGetValue($name) | ||
{ | ||
$fields = $this->repository->findBy( | ||
['name' => $name], | ||
[['name' => 'ASC'], null, null] | ||
); | ||
|
||
if (!$fields) | ||
return; | ||
|
||
return $fields[0]->getValue(); | ||
} | ||
} |
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,38 @@ | ||
<?php | ||
|
||
namespace WilliamEspindola\Field\Service; | ||
|
||
use WilliamEspindola\Field\Repository\RepositoryInterface; | ||
|
||
/** | ||
* Class DoctrineOptionService | ||
* @package WilliamEspindola\Field\Service | ||
*/ | ||
class DoctrineOptionService | ||
{ | ||
/** | ||
* @var RepositoryInterface | ||
*/ | ||
protected $repository; | ||
|
||
/** | ||
* @param RepositoryInterface $repository | ||
*/ | ||
public function __costruct(RepositoryInterface $repository) | ||
{ | ||
$this->repository = $repository; | ||
} | ||
|
||
/** | ||
* @param Object $field | ||
* @param String $order | ||
* @return ArrayObject Options of field | ||
*/ | ||
public function getOptionsOfField($field, Array $order) | ||
{ | ||
return $this->repository->findBy( | ||
['field_id' => $field->getId()], | ||
[$order, null, null] | ||
); | ||
} | ||
} |
Oops, something went wrong.