Skip to content

Commit

Permalink
Code review fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-marcel committed Mar 12, 2015
1 parent 50beb61 commit 8c74dec
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 27 deletions.
3 changes: 0 additions & 3 deletions DependencyInjection/Compiler/RegisterServiceCompilerPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@

use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;

/**
* The RegisterServiceCompilerPass class
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function getConfigTreeBuilder() {
->scalarNode('secret_key')
->beforeNormalization()
->ifNull()
->thenInvalid('You must specifiy secret_key option')
->thenInvalid('You must specify secret_key option')
->end()
->end()
->scalarNode('encryptor_class')
Expand Down
1 change: 0 additions & 1 deletion DependencyInjection/DoctrineEncryptExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Symfony\Component\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\DependencyInjection\Definition;

/**
* Initialization of bundle.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ I'm using Semantic Versioning like described [here](http://semver.org)

The following items will be done in order

1. Review of complete code + fixes/improvements and inline documentation (2.2)
~~1. Review of complete code + fixes/improvements and inline documentation (2.1.1)~~
2. Add support for the other doctrine relationships (manyToMany, ManyToOne) (2.3)
3. Add "Encryption" (reformating based on key) of integers, data time object (2.4)
4. Recreate documentation (2.5)
Expand All @@ -69,12 +69,12 @@ The following items will be done in order

#####Goals:

v2.2 - 12-03-2015
v2.3 - 17-03-2015
v2.4 - 20-03-2015
v2.5 - 21-03-2015
v2.6 - 31-03-2015
v2.7 - unknown
v2.8 - unknown
v2.9 - unknown
v3.0 - 20-05-2015
- v2.2 - 12-03-2015
- v2.3 - 17-03-2015
- v2.4 - 20-03-2015
- v2.5 - 21-03-2015
- v2.6 - 31-03-2015
- v2.7 - unknown
- v2.8 - unknown
- v2.9 - unknown
- v3.0 - 20-05-2015
15 changes: 4 additions & 11 deletions Subscribers/DoctrineEncryptSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,18 @@
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\PreUpdateEventArgs;
use Doctrine\Common\Annotations\Reader;
use \Doctrine\ORM\EntityManager;
use Doctrine\Common\Util\ClassUtils;
use \ReflectionClass;
use Ambta\DoctrineEncryptBundle\Encryptors\EncryptorInterface;
use Symfony\Component\Security\Core\Util\ClassUtils;

/**
* Doctrine event subscriber which encrypt/decrypt entities
*/
class DoctrineEncryptSubscriber implements EventSubscriber {

/**
* Encryptor interface namespace
*/

const ENCRYPTOR_INTERFACE_NS = 'Ambta\DoctrineEncryptBundle\Encryptors\EncryptorInterface';

/**
Expand All @@ -39,12 +38,6 @@ class DoctrineEncryptSubscriber implements EventSubscriber {
*/
private $annReader;

/**
* Register to avoid multi decode operations for one entity
* @var array
*/
private $decodedRegistry = array();

/**
* Initialization of subscriber
*
Expand Down Expand Up @@ -135,7 +128,7 @@ private function processFields($entity, $isEncryptOperation = true) {
$encryptorMethod = $isEncryptOperation ? 'encrypt' : 'decrypt';

//Get the real class, we don't want to use the proxy classes
$realClass = \Doctrine\Common\Util\ClassUtils::getClass($entity);
$realClass = ClassUtils::getClass($entity);

//Get ReflectionClass of our entity
$reflectionClass = new ReflectionClass($realClass);
Expand All @@ -152,7 +145,7 @@ private function processFields($entity, $isEncryptOperation = true) {

/**
* Lazy loading, check if the property has an manyToOne relationship.
* if it has look if the set/get exists and recursively call this function based on the entity inside. Only if not empty ofcourse
* if it has look if the set/get exists and recursively call this function based on the entity inside. Only if not empty.
*/
if($this->annReader->getPropertyAnnotation($refProperty, 'Doctrine\ORM\Mapping\ManyToOne')) {
if ($reflectionClass->hasMethod($getter = 'get' . $methodName) && $reflectionClass->hasMethod($setter = 'set' . $methodName)) {
Expand Down

0 comments on commit 8c74dec

Please sign in to comment.