Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added inheritance mapping support in uploadable entities for the YAML driver #5

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
c1f3167
Update TranslationWalker.php
birko Mar 24, 2014
5b17b77
Update TranslationWalker.php
birko Mar 24, 2014
e5f5b4c
Update PersonalTranslationTest.php
birko Mar 25, 2014
aa42703
Revert "Update PersonalTranslationTest.php"
Mar 25, 2014
c57b1bb
Merge pull request #1025 from birko/patch-1
l3pp4rd Mar 25, 2014
1dc1e74
Travis email notifications for A18 developers
Mar 27, 2014
5260d9f
Remove unsed code
Apr 3, 2014
741cee6
Perform apostrophe purge before converting none-word characters to hy…
Apr 8, 2014
f53872c
Update uploadable.md
marcaube Apr 8, 2014
0fd4ee0
Merge pull request #1040 from marcaube/patch-2
l3pp4rd Apr 12, 2014
610dfee
Merge pull request #1039 from rawkode/master
l3pp4rd Apr 12, 2014
f2cd335
Merge pull request #1032 from GeniusesOfSymfony/master
l3pp4rd Apr 12, 2014
b890921
Fix updating uploadable entity: correct file path in pendingFileRemov…
boda2004 Apr 20, 2014
47ed3e4
Merge pull request #1049 from boda2004/master
l3pp4rd Apr 21, 2014
1e6ca3f
Clear the wrapper cache after the flush event is done
May 1, 2014
377b222
Remove unneeded namespace includes
hallabro May 2, 2014
842b6a7
Merge pull request #1060 from hallabro/remove-unused-namespace-includes
stof May 2, 2014
8e84ac1
Merge pull request #1057 from captolia/master
l3pp4rd May 3, 2014
35ca7fd
Update Sluggable.php
bes89 May 4, 2014
6120bd0
Merge pull request #1063 from bes89/patch-1
l3pp4rd May 4, 2014
ecf70f0
Fixed failing test for blameable
May 8, 2014
352a5a8
Merge pull request #1070 from Engerim/bugfix_blameable
stof May 9, 2014
a3d80be
Add @var annotations to the Traits for TYPO3.Flow support
Jun 6, 2014
de89aae
Merge pull request #1092 from mneuhaus/flow
stof Jun 6, 2014
cd721cc
Added inheritance mapping support in uploadable entities for the YAML…
MisatoTremor Jun 6, 2014
760379d
Merge branch 'master' of git://github.com/Atlantic18/DoctrineExtensions
MisatoTremor Jun 23, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ script: phpunit --coverage-text -c tests/
notifications:
email:
- [email protected]
- [email protected]
2 changes: 1 addition & 1 deletion doc/uploadable.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Entity\File:
type: string
gedmo:
- uploadableFilePath
path:
name:
type: string
gedmo:
- uploadableFileName
Expand Down
6 changes: 4 additions & 2 deletions lib/Gedmo/Blameable/BlameableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

namespace Gedmo\Blameable;

use Doctrine\Common\EventArgs;
use Doctrine\Common\NotifyPropertyChanged;
use Gedmo\Exception\InvalidArgumentException;
use Gedmo\Mapping\MappedEventSubscriber;
use Gedmo\Timestampable\TimestampableListener;
use Gedmo\Blameable\Mapping\Event\BlameableAdapter;

Expand Down Expand Up @@ -83,6 +81,10 @@ protected function updateField($object, $ea, $meta, $field)
$oldValue = $property->getValue($object);
$newValue = $this->getUserValue($meta, $field);

//if blame is reference, persist object
if ($meta->hasAssociation($field)) {
$ea->getObjectManager()->persist($newValue);
}
$property->setValue($object, $newValue);
if ($object instanceof NotifyPropertyChanged) {
$uow = $ea->getObjectManager()->getUnitOfWork();
Expand Down
1 change: 0 additions & 1 deletion lib/Gedmo/Blameable/Mapping/Event/Adapter/ORM.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Gedmo\Mapping\Event\Adapter\ORM as BaseAdapterORM;
use Gedmo\Blameable\Mapping\Event\BlameableAdapter;
use Gedmo\Exception\InvalidArgumentException;

/**
* Doctrine event adapter for ORM adapted
Expand Down
2 changes: 2 additions & 0 deletions lib/Gedmo/Blameable/Traits/BlameableDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
trait BlameableDocument
{
/**
* @var string
* @Gedmo\Blameable(on="create")
* @ODM\String
*/
private $createdBy;

/**
* @var string
* @Gedmo\Blameable(on="update")
* @ODM\String
*/
Expand Down
2 changes: 2 additions & 0 deletions lib/Gedmo/Blameable/Traits/BlameableEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
trait BlameableEntity
{
/**
* @var string
* @Gedmo\Blameable(on="create")
* @ORM\Column(type="string", nullable=true)
*/
private $createdBy;

/**
* @var string
* @Gedmo\Blameable(on="update")
* @ORM\Column(type="string", nullable=true)
*/
Expand Down
2 changes: 2 additions & 0 deletions lib/Gedmo/IpTraceable/Traits/IpTraceableDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
trait IpTraceableDocument
{
/**
* @var string
* @Gedmo\IpTraceable(on="create")
* @ODM\String
*/
private $createdFromIp;

/**
* @var string
* @Gedmo\IpTraceable(on="update")
* @ODM\String
*/
Expand Down
2 changes: 2 additions & 0 deletions lib/Gedmo/IpTraceable/Traits/IpTraceableEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
trait IpTraceableEntity
{
/**
* @var string
* @Gedmo\IpTraceable(on="create")
* @ORM\Column(type="string", length=45, nullable=true)
*/
protected $createdFromIp;

/**
* @var string
* @Gedmo\IpTraceable(on="update")
* @ORM\Column(type="string", length=45, nullable=true)
*/
Expand Down
1 change: 0 additions & 1 deletion lib/Gedmo/Mapping/Driver/AbstractAnnotationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Gedmo\Mapping\Driver;

use Gedmo\Mapping\Driver\AnnotationDriverInterface;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;

/**
Expand Down
1 change: 0 additions & 1 deletion lib/Gedmo/Mapping/ExtensionMetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
use Doctrine\Common\Version as CommonLibVer;
use Gedmo\Mapping\Driver\File as FileDriver;
use Gedmo\Mapping\Driver\AnnotationDriverInterface;
use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory;

/**
* The extension metadata factory is responsible for extension driver
Expand Down
1 change: 0 additions & 1 deletion lib/Gedmo/Mapping/MappedEventSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Doctrine\Common\Annotations\AnnotationReader;
use Doctrine\Common\Annotations\CachedReader;
use Doctrine\Common\Cache\ArrayCache;
use Gedmo\Mapping\ExtensionMetadataFactory;
use Doctrine\Common\EventSubscriber;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Common\EventArgs;
Expand Down
2 changes: 0 additions & 2 deletions lib/Gedmo/References/Mapping/Event/Adapter/ODM.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

namespace Gedmo\References\Mapping\Event\Adapter;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Proxy\Proxy as MongoDBProxy;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Proxy\Proxy as ORMProxy;
use Gedmo\Exception\InvalidArgumentException;
use Gedmo\Mapping\Event\Adapter\ODM as BaseAdapterODM;
use Gedmo\References\Mapping\Event\ReferencesAdapter;

Expand Down
1 change: 0 additions & 1 deletion lib/Gedmo/References/Mapping/Event/Adapter/ORM.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Gedmo\References\Mapping\Event\Adapter;

use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Proxy\Proxy as MongoDBProxy;
use Doctrine\ORM\EntityManager;
Expand Down
1 change: 0 additions & 1 deletion lib/Gedmo/References/Mapping/Event/ReferencesAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Gedmo\References\Mapping\Event;

use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\Common\Persistence\ObjectManager;
use Gedmo\Mapping\Event\AdapterInterface;

Expand Down
5 changes: 0 additions & 5 deletions lib/Gedmo/References/ReferencesListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\EventArgs;
use Doctrine\ORM\Mapping\ClassMetadata as ORMClassMetadata;
use Doctrine\ORM\EntityManager;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadata as MongoDBClassMetadata;
use Gedmo\Exception\InvalidArgumentException;
use Gedmo\Mapping\MappedEventSubscriber;

/**
Expand Down
2 changes: 1 addition & 1 deletion lib/Gedmo/Sluggable/Sluggable.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ interface Sluggable
*
* example:
*
* @gedmo:Slug(style="camel", separator="_", prefix="", suffix="" updatable=false, unique=false)
* @gedmo:Slug(style="camel", separator="_", prefix="", suffix="", updatable=false, unique=false)
* @Column(type="string", length=64)
* $property
*/
Expand Down
3 changes: 3 additions & 0 deletions lib/Gedmo/Sluggable/SluggableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use Gedmo\Mapping\MappedEventSubscriber;
use Gedmo\Sluggable\Mapping\Event\SluggableAdapter;
use Doctrine\Common\Persistence\ObjectManager;
use Gedmo\Tool\Wrapper\AbstractWrapper;

/**
* The SluggableListener handles the generation of slugs
Expand Down Expand Up @@ -224,6 +225,8 @@ public function onFlush(EventArgs $args)
}

$this->manageFiltersAfterGeneration($om);

AbstractWrapper::clear();
}

/**
Expand Down
5 changes: 5 additions & 0 deletions lib/Gedmo/Sluggable/Util/Urlizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,11 @@ private static function postProcessText($text, $separator)
$text = strtolower($text);
}

// Should remove apostrophes prior to none-word characters,
// as replacing with hyphens isn't ideal.
// Consider: Bon Jovi's Tour Cancelled (bon-jovi-s-tour-cancelled)
$text = preg_replace("/'/", '', $text);

// Remove all none word characters
$text = preg_replace('/\W/', ' ', $text);

Expand Down
1 change: 0 additions & 1 deletion lib/Gedmo/SoftDeleteable/Mapping/Event/Adapter/ORM.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Gedmo\Mapping\Event\Adapter\ORM as BaseAdapterORM;
use Gedmo\SoftDeleteable\Mapping\Event\SoftDeleteableAdapter;
use Gedmo\Exception\InvalidArgumentException;

/**
* Doctrine event adapter for ORM adapted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\AST\DeleteStatement;
use Doctrine\ORM\Query\AST\DeleteClause;
use Doctrine\ORM\Query\AST\UpdateClause;
use Doctrine\ORM\Query\AST\UpdateItem;
use Doctrine\ORM\Query\Exec\SingleTableDeleteUpdateExecutor;
use Doctrine\ORM\Query\AST\PathExpression;
use Gedmo\SoftDeleteable\SoftDeleteableListener;
use Gedmo\SoftDeleteable\Query\TreeWalker\Exec\MultiTableDeleteExecutor;

Expand Down
1 change: 1 addition & 0 deletions lib/Gedmo/SoftDeleteable/Traits/SoftDeleteableDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
trait SoftDeleteableDocument
{
/**
* @var \DateTime
* @ODM\Date
*/
protected $deletedAt;
Expand Down
1 change: 1 addition & 0 deletions lib/Gedmo/SoftDeleteable/Traits/SoftDeleteableEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
trait SoftDeleteableEntity
{
/**
* @var \DateTime
* @ORM\Column(type="datetime", nullable=true)
*/
protected $deletedAt;
Expand Down
1 change: 0 additions & 1 deletion lib/Gedmo/Sortable/Mapping/Event/Adapter/ODM.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Gedmo\Sortable\Mapping\Event\Adapter;

use Gedmo\Mapping\Event\Adapter\ODM as BaseAdapterODM;
use Doctrine\ODM\MongoDB\Cursor;
use Gedmo\Sortable\Mapping\Event\SortableAdapter;

/**
Expand Down
1 change: 0 additions & 1 deletion lib/Gedmo/Sortable/Mapping/Event/Adapter/ORM.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Gedmo\Sortable\Mapping\Event\Adapter;

use Gedmo\Mapping\Event\Adapter\ORM as BaseAdapterORM;
use Doctrine\ORM\Query;
use Gedmo\Sortable\Mapping\Event\SortableAdapter;

/**
Expand Down
2 changes: 2 additions & 0 deletions lib/Gedmo/Timestampable/Traits/TimestampableDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
trait TimestampableDocument
{
/**
* @var \DateTime
* @Gedmo\Timestampable(on="create")
* @ODM\Date
*/
private $createdAt;

/**
* @var \DateTime
* @Gedmo\Timestampable(on="update")
* @ODM\Date
*/
Expand Down
2 changes: 2 additions & 0 deletions lib/Gedmo/Timestampable/Traits/TimestampableEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@
trait TimestampableEntity
{
/**
* @var \DateTime
* @Gedmo\Timestampable(on="create")
* @ORM\Column(type="datetime")
*/
protected $createdAt;

/**
* @var \DateTime
* @Gedmo\Timestampable(on="update")
* @ORM\Column(type="datetime")
*/
Expand Down
1 change: 0 additions & 1 deletion lib/Gedmo/Translatable/Mapping/Event/Adapter/ODM.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Gedmo\Mapping\Event\Adapter\ODM as BaseAdapterODM;
use Gedmo\Tool\Wrapper\AbstractWrapper;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo;
use Doctrine\ODM\MongoDB\Cursor;
use Gedmo\Translatable\Mapping\Event\TranslatableAdapter;
Expand Down
6 changes: 4 additions & 2 deletions lib/Gedmo/Translatable/Query/TreeWalker/TranslationWalker.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Doctrine\DBAL\Types\Type;
use Doctrine\ORM\Query;
use Doctrine\ORM\Query\SqlWalker;
use Doctrine\ORM\Query\TreeWalkerAdapter;
use Doctrine\ORM\Query\AST\SelectStatement;
use Doctrine\ORM\Query\Exec\SingleSelectExecutor;
use Doctrine\ORM\Query\AST\RangeVariableDeclaration;
Expand Down Expand Up @@ -317,7 +316,10 @@ private function prepareTranslatedComponents()

// Treat translation as original field type
$fieldMapping = $meta->getFieldMapping($field);
if (!in_array($fieldMapping["type"], array("datetime", "datetimetz", "date", "time"))) {
if ((($this->platform instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) &&
in_array($fieldMapping["type"], array("decimal"))) ||
(!($this->platform instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) &&
!in_array($fieldMapping["type"], array("datetime", "datetimetz", "date", "time")))) {
$type = Type::getType($fieldMapping["type"]);
$substituteField = 'CAST(' . $substituteField . ' AS ' . $type->getSQLDeclaration($fieldMapping, $this->platform) . ')';
}
Expand Down
3 changes: 0 additions & 3 deletions lib/Gedmo/Translatable/TranslatableListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
use Gedmo\Tool\Wrapper\AbstractWrapper;
use Gedmo\Mapping\MappedEventSubscriber;
use Gedmo\Translatable\Mapping\Event\TranslatableAdapter;
use Gedmo\Translatable\Entity\MappedSuperclass\AbstractPersonalTranslation;
use Gedmo\Translatable\Entity\MappedSuperclass\AbstractTranslation;

/**
* The translation listener handles the generation and
* loading of translations for entities which implements
Expand Down
1 change: 0 additions & 1 deletion lib/Gedmo/Tree/Entity/Repository/ClosureTreeRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Gedmo\Tree\Strategy;
use Gedmo\Tree\Strategy\ORM\Closure;
use Gedmo\Tool\Wrapper\EntityWrapper;
use Doctrine\ORM\Proxy\Proxy;

/**
* The ClosureTreeRepository has some useful functions
Expand Down
3 changes: 0 additions & 3 deletions lib/Gedmo/Tree/Mapping/Event/Adapter/ODM.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
namespace Gedmo\Tree\Mapping\Event\Adapter;

use Gedmo\Mapping\Event\Adapter\ODM as BaseAdapterODM;
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Mapping\ClassMetadataInfo;
use Doctrine\ODM\MongoDB\Cursor;
use Gedmo\Tree\Mapping\Event\TreeAdapter;

/**
Expand Down
3 changes: 0 additions & 3 deletions lib/Gedmo/Tree/Mapping/Event/Adapter/ORM.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
namespace Gedmo\Tree\Mapping\Event\Adapter;

use Gedmo\Mapping\Event\Adapter\ORM as BaseAdapterORM;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Query;
use Gedmo\Tree\Mapping\Event\TreeAdapter;

/**
Expand Down
3 changes: 0 additions & 3 deletions lib/Gedmo/Tree/Strategy/AbstractMaterializedPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
namespace Gedmo\Tree\Strategy;

use Gedmo\Tree\Strategy;
use Doctrine\ORM\EntityManager;
use Gedmo\Tree\TreeListener;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Query;
use Doctrine\Common\Persistence\ObjectManager;
use Gedmo\Mapping\Event\AdapterInterface;
use Gedmo\Exception\RuntimeException;
Expand Down
1 change: 0 additions & 1 deletion lib/Gedmo/Tree/Strategy/ORM/Closure.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Doctrine\DBAL\Connection;
use Doctrine\ORM\Version;
use Doctrine\ORM\Proxy\Proxy;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\Common\Persistence\ObjectManager;
Expand Down
2 changes: 0 additions & 2 deletions lib/Gedmo/Tree/Strategy/ORM/MaterializedPath.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
namespace Gedmo\Tree\Strategy\ORM;

use Gedmo\Tree\Strategy\AbstractMaterializedPath;
use Doctrine\Common\Persistence\ObjectManager;
use Gedmo\Mapping\Event\AdapterInterface;
use Gedmo\Tool\Wrapper\AbstractWrapper;

/**
Expand Down
2 changes: 0 additions & 2 deletions lib/Gedmo/Tree/Strategy/ORM/Nested.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

use Gedmo\Exception\UnexpectedValueException;
use Doctrine\ORM\Proxy\Proxy;
use Gedmo\Tool\Wrapper\EntityWrapper;
use Gedmo\Tool\Wrapper\AbstractWrapper;
use Gedmo\Tree\Strategy;
use Doctrine\ORM\EntityManager;
use Gedmo\Tree\TreeListener;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
use Doctrine\ORM\Query;
use Gedmo\Mapping\Event\AdapterInterface;

Expand Down
Loading