From aeb59c5a88a41cab669e37aa50ae508c09917a29 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Sun, 11 Dec 2016 06:01:32 +0300 Subject: [PATCH 1/3] CodeShip badge link. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b4bd86b..3a2997b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![CodeShip badge](https://codeship.com/projects/bb9fe730-a175-0134-5572-12490b0b4938/status?branch=master) +[ ![Codeship Status for skobkin/point-tools](https://app.codeship.com/projects/bb9fe730-a175-0134-5572-12490b0b4938/status?branch=master)](https://app.codeship.com/projects/189850) # Point Tools From 1a5ce08fcd949546405f0c519555872a230ae1ec Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Sun, 11 Dec 2016 06:03:59 +0300 Subject: [PATCH 2/3] Doctrine entities mapping fix. Excessive schemas removed. --- src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Comment.php | 4 ++-- src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/File.php | 2 +- src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Post.php | 4 ++-- src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/PostTag.php | 2 +- src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Tag.php | 2 +- src/Skobkin/Bundle/PointToolsBundle/Entity/Subscription.php | 2 +- .../Bundle/PointToolsBundle/Entity/SubscriptionEvent.php | 2 +- src/Skobkin/Bundle/PointToolsBundle/Entity/User.php | 2 +- .../Bundle/PointToolsBundle/Entity/UserRenameEvent.php | 2 +- 9 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Comment.php b/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Comment.php index 1dbbaaa..5530c99 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Comment.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Comment.php @@ -9,7 +9,7 @@ use Skobkin\Bundle\PointToolsBundle\Entity\User; /** * Comment * - * @ORM\Table(name="posts.comments", schema="posts", indexes={ + * @ORM\Table(name="comments", schema="posts", indexes={ * @ORM\Index(name="idx_comment_created_at", columns={"created_at"}) * }) * @ORM\Entity @@ -80,7 +80,7 @@ class Comment * @var File[]|ArrayCollection * * @ORM\ManyToMany(targetEntity="Skobkin\Bundle\PointToolsBundle\Entity\Blogs\File", fetch="EXTRA_LAZY", cascade={"persist"}) - * @ORM\JoinTable(name="posts.comments_files", schema="posts", + * @ORM\JoinTable(name="comments_files", schema="posts", * joinColumns={@ORM\JoinColumn(name="comment_id")}, * inverseJoinColumns={@ORM\JoinColumn(name="file_id")} * ) diff --git a/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/File.php b/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/File.php index d1f9841..ebf37de 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/File.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/File.php @@ -7,7 +7,7 @@ use Doctrine\ORM\Mapping as ORM; /** * File * - * @ORM\Table(name="posts.files", schema="posts") + * @ORM\Table(name="files", schema="posts") * @ORM\Entity(repositoryClass="Skobkin\Bundle\PointToolsBundle\Repository\Blogs\FileRepository") */ class File diff --git a/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Post.php b/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Post.php index 170ef76..ae679bf 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Post.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Post.php @@ -9,7 +9,7 @@ use Skobkin\Bundle\PointToolsBundle\Entity\User; /** * Post * - * @ORM\Table(name="posts.posts", schema="posts", indexes={ + * @ORM\Table(name="posts", schema="posts", indexes={ * @ORM\Index(name="idx_post_created_at", columns={"created_at"}), * @ORM\Index(name="idx_post_private", columns={"private"}), * }) @@ -83,7 +83,7 @@ class Post * @var File[]|ArrayCollection * * @ORM\ManyToMany(targetEntity="Skobkin\Bundle\PointToolsBundle\Entity\Blogs\File", fetch="EXTRA_LAZY", cascade={"persist"}) - * @ORM\JoinTable(name="posts.posts_files", schema="posts", + * @ORM\JoinTable(name="posts_files", schema="posts", * joinColumns={@ORM\JoinColumn(name="post_id")}, * inverseJoinColumns={@ORM\JoinColumn(name="file_id")} * ) diff --git a/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/PostTag.php b/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/PostTag.php index a25027b..0fe61c8 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/PostTag.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/PostTag.php @@ -7,7 +7,7 @@ use Doctrine\ORM\Mapping as ORM; /** * PostTag * - * @ORM\Table(name="posts.posts_tags", schema="posts") + * @ORM\Table(name="posts_tags", schema="posts") * @ORM\Entity(repositoryClass="Skobkin\Bundle\PointToolsBundle\Repository\Blogs\PostTagRepository") */ class PostTag diff --git a/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Tag.php b/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Tag.php index 91cdc8e..e510cb6 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Tag.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Entity/Blogs/Tag.php @@ -7,7 +7,7 @@ use Doctrine\ORM\Mapping as ORM; /** * Tag * - * @ORM\Table(name="posts.tags", schema="posts", indexes={ + * @ORM\Table(name="tags", schema="posts", indexes={ * @ORM\Index(name="idx_tag_text", columns={"text"}) * }) * @ORM\Entity(repositoryClass="Skobkin\Bundle\PointToolsBundle\Repository\Blogs\TagRepository") diff --git a/src/Skobkin/Bundle/PointToolsBundle/Entity/Subscription.php b/src/Skobkin/Bundle/PointToolsBundle/Entity/Subscription.php index 19ea360..7115faa 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Entity/Subscription.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Entity/Subscription.php @@ -7,7 +7,7 @@ use Doctrine\ORM\Mapping as ORM; /** * Subscription * - * @ORM\Table(name="subscriptions.subscriptions", schema="subscriptions", uniqueConstraints={ + * @ORM\Table(name="subscriptions", schema="subscriptions", uniqueConstraints={ * @ORM\UniqueConstraint(name="subscription_unique", columns={"author_id", "subscriber_id"})} * ) * @ORM\Entity(repositoryClass="Skobkin\Bundle\PointToolsBundle\Repository\SubscriptionRepository") diff --git a/src/Skobkin/Bundle/PointToolsBundle/Entity/SubscriptionEvent.php b/src/Skobkin/Bundle/PointToolsBundle/Entity/SubscriptionEvent.php index c04e55a..36be206 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Entity/SubscriptionEvent.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Entity/SubscriptionEvent.php @@ -7,7 +7,7 @@ use Doctrine\ORM\Mapping as ORM; /** * SubscriptionEvent * - * @ORM\Table(name="subscriptions.log", schema="subscriptions", indexes={ + * @ORM\Table(name="log", schema="subscriptions", indexes={ * @ORM\Index(name="author_idx", columns={"author_id"}), * @ORM\Index(name="subscriber_idx", columns={"subscriber_id"}), * @ORM\Index(name="date_idx", columns={"date"}) diff --git a/src/Skobkin/Bundle/PointToolsBundle/Entity/User.php b/src/Skobkin/Bundle/PointToolsBundle/Entity/User.php index 0860cd6..6485677 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Entity/User.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Entity/User.php @@ -8,7 +8,7 @@ use Doctrine\ORM\Mapping as ORM; /** * User * - * @ORM\Table(name="users.users", schema="users") + * @ORM\Table(name="users", schema="users") * @ORM\Entity(repositoryClass="Skobkin\Bundle\PointToolsBundle\Repository\UserRepository") * @ORM\HasLifecycleCallbacks */ diff --git a/src/Skobkin/Bundle/PointToolsBundle/Entity/UserRenameEvent.php b/src/Skobkin/Bundle/PointToolsBundle/Entity/UserRenameEvent.php index caf7367..a5e697f 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Entity/UserRenameEvent.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Entity/UserRenameEvent.php @@ -7,7 +7,7 @@ use Doctrine\ORM\Mapping as ORM; /** * UserRenameEvent * - * @ORM\Table(name="users.rename_log", schema="users", indexes={ + * @ORM\Table(name="rename_log", schema="users", indexes={ * @ORM\Index(name="idx_rename_log_date", columns={"date"}), * @ORM\Index(name="idx_rename_log_old_login", columns={"old_login"}) * }) From 874ff4279726a7cfb5a7fcb8ead4c76c5ddf30a2 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Sun, 11 Dec 2016 06:23:03 +0300 Subject: [PATCH 3/3] composer update. Query fix. --- composer.json | 4 +- composer.lock | 67 +++++++++++-------- .../Repository/SubscriptionRepository.php | 6 +- 3 files changed, 44 insertions(+), 33 deletions(-) diff --git a/composer.json b/composer.json index 36f8885..f0e71fc 100644 --- a/composer.json +++ b/composer.json @@ -9,8 +9,8 @@ "require": { "php": ">=5.3.3", "symfony/symfony": "2.7.*", - "doctrine/orm": "~2.2,>=2.2.3,<2.5", - "doctrine/dbal": "<2.5", + "doctrine/orm": "~2.4,<2.7.0", + "doctrine/dbal": "~2.4", "doctrine/doctrine-bundle": "~1.4", "twig/extensions": "~1.0", "symfony/assetic-bundle": "~2.3", diff --git a/composer.lock b/composer.lock index 33f1b09..009cf88 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "730ff4da78d65c53b95f3a273c73c89b", + "content-hash": "6c27cec95d59f5ae16b2287be0b2ba05", "packages": [ { "name": "doctrine/annotations", @@ -212,16 +212,16 @@ }, { "name": "doctrine/common", - "version": "v2.7.1", + "version": "v2.6.2", "source": { "type": "git", "url": "https://github.com/doctrine/common.git", - "reference": "5954c297e9d93ff84554906c2fbbc2a133c43941" + "reference": "7bce00698899aa2c06fe7365c76e4d78ddb15fa3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/5954c297e9d93ff84554906c2fbbc2a133c43941", - "reference": "5954c297e9d93ff84554906c2fbbc2a133c43941", + "url": "https://api.github.com/repos/doctrine/common/zipball/7bce00698899aa2c06fe7365c76e4d78ddb15fa3", + "reference": "7bce00698899aa2c06fe7365c76e4d78ddb15fa3", "shasum": "" }, "require": { @@ -230,10 +230,10 @@ "doctrine/collections": "1.*", "doctrine/inflector": "1.*", "doctrine/lexer": "1.*", - "php": "~5.6|~7.0" + "php": "~5.5|~7.0" }, "require-dev": { - "phpunit/phpunit": "^5.4.6" + "phpunit/phpunit": "~4.8|~5.0" }, "type": "library", "extra": { @@ -281,34 +281,42 @@ "persistence", "spl" ], - "time": "2016-12-03T08:15:01+00:00" + "time": "2016-11-30T16:50:46+00:00" }, { "name": "doctrine/dbal", - "version": "v2.4.5", + "version": "v2.5.5", "source": { "type": "git", "url": "https://github.com/doctrine/dbal.git", - "reference": "5a1f4bf34d61d997ccd9f0539fbc14c7a772aa16" + "reference": "9f8c05cd5225a320d56d4bfdb4772f10d045a0c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/5a1f4bf34d61d997ccd9f0539fbc14c7a772aa16", - "reference": "5a1f4bf34d61d997ccd9f0539fbc14c7a772aa16", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/9f8c05cd5225a320d56d4bfdb4772f10d045a0c9", + "reference": "9f8c05cd5225a320d56d4bfdb4772f10d045a0c9", "shasum": "" }, "require": { - "doctrine/common": "~2.4", + "doctrine/common": ">=2.4,<2.7-dev", "php": ">=5.3.2" }, "require-dev": { - "phpunit/phpunit": "3.7.*", - "symfony/console": "~2.0" + "phpunit/phpunit": "4.*", + "symfony/console": "2.*||^3.0" }, "suggest": { "symfony/console": "For helpful console commands such as SQL execution and import of files." }, + "bin": [ + "bin/doctrine-dbal" + ], "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5.x-dev" + } + }, "autoload": { "psr-0": { "Doctrine\\DBAL\\": "lib/" @@ -344,7 +352,7 @@ "persistence", "queryobject" ], - "time": "2016-01-05T22:18:20+00:00" + "time": "2016-09-09T19:13:33+00:00" }, { "name": "doctrine/doctrine-bundle", @@ -826,28 +834,31 @@ }, { "name": "doctrine/orm", - "version": "v2.4.8", + "version": "v2.5.5", "source": { "type": "git", "url": "https://github.com/doctrine/doctrine2.git", - "reference": "5aedac1e5c5caaeac14798822c70325dc242d467" + "reference": "73e4be7c7b3ba26f96b781a40b33feba4dfa6d45" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/5aedac1e5c5caaeac14798822c70325dc242d467", - "reference": "5aedac1e5c5caaeac14798822c70325dc242d467", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/73e4be7c7b3ba26f96b781a40b33feba4dfa6d45", + "reference": "73e4be7c7b3ba26f96b781a40b33feba4dfa6d45", "shasum": "" }, "require": { - "doctrine/collections": "~1.1", - "doctrine/dbal": "~2.4", + "doctrine/cache": "~1.4", + "doctrine/collections": "~1.2", + "doctrine/common": ">=2.5-dev,<2.7-dev", + "doctrine/dbal": ">=2.5-dev,<2.6-dev", + "doctrine/instantiator": "~1.0.1", "ext-pdo": "*", - "php": ">=5.3.2", - "symfony/console": "~2.0" + "php": ">=5.4", + "symfony/console": "~2.5|~3.0" }, "require-dev": { - "satooshi/php-coveralls": "dev-master", - "symfony/yaml": "~2.1" + "phpunit/phpunit": "~4.0", + "symfony/yaml": "~2.3|~3.0" }, "suggest": { "symfony/yaml": "If you want to use YAML Metadata Mapping Driver" @@ -859,7 +870,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4.x-dev" + "dev-master": "2.6.x-dev" } }, "autoload": { @@ -895,7 +906,7 @@ "database", "orm" ], - "time": "2015-08-31T13:19:01+00:00" + "time": "2016-09-10T18:51:13+00:00" }, { "name": "guzzle/guzzle", diff --git a/src/Skobkin/Bundle/PointToolsBundle/Repository/SubscriptionRepository.php b/src/Skobkin/Bundle/PointToolsBundle/Repository/SubscriptionRepository.php index bc3ca99..0c02625 100644 --- a/src/Skobkin/Bundle/PointToolsBundle/Repository/SubscriptionRepository.php +++ b/src/Skobkin/Bundle/PointToolsBundle/Repository/SubscriptionRepository.php @@ -18,9 +18,9 @@ class SubscriptionRepository extends EntityRepository $qb = $this->createQueryBuilder('s'); return $qb - ->select('COUNT(s)') - ->innerJoin('s.author', 'a') - ->where('a.id = :id') + ->select('COUNT(s.subscriber)') + ->innerJoin('s.author', 'sa') + ->where('sa.id = :id') ->setParameter('id', $id) ->getQuery()->getSingleScalarResult() ;