Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

small changes #45

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
phpunit.xml
coverage
vendor/symfony
vendor/twig
vendor/twitteroauth
vendor/
6 changes: 1 addition & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ php:
- 5.3
- 5.4

env:
- SYMFONY_VERSION=v2.0.7
- SYMFONY_VERSION=origin/2.0

before_script: php vendor/vendors.php
before_script: composer install --dev

notifications:
email:
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function getConfigTreeBuilder()
})
->end()
->children()
->scalarNode('file')->defaultValue('%kernel.root_dir%/../vendor/twitteroauth/twitteroauth/twitteroauth.php')->end()
->scalarNode('file')->info('DEPRECATED. To be removed.')->end()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is bumping the requirement to Symfony 2.1 so please update the composer.json file

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what a catch! fixed

->scalarNode('consumer_key')->isRequired()->cannotBeEmpty()->end()
->scalarNode('consumer_secret')->isRequired()->cannotBeEmpty()->end()
->scalarNode('access_token')->defaultNull()->end()
Expand Down
2 changes: 1 addition & 1 deletion DependencyInjection/FOSTwitterExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function load(array $configs, ContainerBuilder $container)
$container->setAlias($config['alias'], 'fos_twitter.service');
}

foreach (array('file', 'consumer_key', 'consumer_secret', 'callback_url', 'access_token', 'access_token_secret', 'anywhere_version') as $attribute) {
foreach (array('consumer_key', 'consumer_secret', 'callback_url', 'access_token', 'access_token_secret', 'anywhere_version') as $attribute) {
if (isset($config[$attribute])) {
$container->setParameter('fos_twitter.'.$attribute, $config[$attribute]);
}
Expand Down
23 changes: 7 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,15 @@ database based solution provided by FOSUserBundle.
Installation
============

1. Add this bundle and Abraham Williams' Twitter library to your project as Git submodules:
1. Add this bundle to your project's ```composer.json``` :

$ git submodule add git://github.com/FriendsOfSymfony/FOSTwitterBundle.git vendor/bundles/FOS/TwitterBundle
$ git submodule add git://github.com/kertz/twitteroauth.git vendor/twitteroauth
"require": {
"_some_package": "*",

>**Note:** The kertz/twitteroauth is patched to be compatible with FOSTwitterBundle

2. Register the namespace `FOS` to your project's autoloader bootstrap script:

//app/autoload.php
$loader->registerNamespaces(array(
// ...
'FOS' => __DIR__.'/../vendor/bundles',
// ...
));
"friendsofsymfony/twitter-bundle": "1.1.*"
}

3. Add this bundle to your application's kernel:
2. Add this bundle to your application's kernel:

//app/AppKernel.php
public function registerBundles()
Expand All @@ -42,11 +34,10 @@ Installation
);
}

4. Configure the `twitter` service in your YAML configuration:
3. Configure the `twitter` service in your YAML configuration:

#app/config/config.yml
fos_twitter:
file: %kernel.root_dir%/../vendor/twitteroauth/twitteroauth/twitteroauth.php
consumer_key: xxxxxx
consumer_secret: xxxxxx
callback_url: http://www.example.com/login_check
Expand Down
3 changes: 2 additions & 1 deletion Resources/config/schema/twitter-1.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@

<xsd:complexType name="config">
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="file" type="xsd:string" />
<xsd:attribute name="callback_url" type="xsd:string" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the point of keeping it in the Configuration class to avoid breaking things for old configs if you break them before that when validating the schema for people using XML ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're right, I've added a note instead.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but it could also have been a way to make people see the deprecation... usually IDEs show some warning on that situation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the goal of deprecating instead of removing is to provide BC. An XML validation error is not BC (and hard to understand for many people, especially when the same stuff was workign previously)

<xsd:attribute name="anywhere_version" type="xsd:string" />
<xsd:attribute name="consumer_key" type="xsd:string" />
<xsd:attribute name="consumer_secret" type="xsd:string" />
<!-- FOR BC, TO BE REMOVED -->
<xsd:attribute name="file" type="xsd:string" />
</xsd:complexType>

</xsd:schema>
2 changes: 0 additions & 2 deletions Resources/config/twitter.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<parameters>
<parameter key="fos_twitter.file">null</parameter>
<parameter key="fos_twitter.consumer_key">null</parameter>
<parameter key="fos_twitter.consumer_secret">null</parameter>
<parameter key="fos_twitter.access_token">null</parameter>
Expand All @@ -29,7 +28,6 @@

<!-- This is the base API connect service, injected to the wrapper service -->
<service id="fos_twitter.api" class="%fos_twitter.api.class%">
<file>%fos_twitter.file%</file>
<argument key="consumer_key">%fos_twitter.consumer_key%</argument>
<argument key="consumer_secret">%fos_twitter.consumer_secret%</argument>
<argument key="oauth_token">%fos_twitter.access_token%</argument>
Expand Down
3 changes: 1 addition & 2 deletions Tests/DependencyInjection/FOSTwitterExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public function testLoadSuccess()
{
$configs = array(
array(
'file' => 'foo',
'callback_url' => 'foo',
'consumer_key' => 'foo',
'consumer_secret' => 'foo',
Expand All @@ -55,7 +54,7 @@ public function testLoadSuccess()
$container
->expects($this->once())
->method('setAlias')
->with($alias, 'fos_twitter');
->with($alias, 'fos_twitter.service');

$configs[] = array('alias' => $alias);

Expand Down
35 changes: 0 additions & 35 deletions Tests/autoload.php.dist

This file was deleted.

16 changes: 0 additions & 16 deletions Tests/bootstrap.php

This file was deleted.

12 changes: 9 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@
],
"require": {
"php": ">=5.3.2",
"symfony/framework-bundle": "2.*",
"symfony/security-bundle": ">=2.1,<2.3-dev",
"symfony/framework-bundle": "~2.1",
"symfony/security-bundle": "~2.1",
"kertz/twitteroauth": "*"
},
"minimum-stability": "dev",
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because "kertz/twitteroauth" has no stable version cc @Kertz

"autoload": {
"psr-0": { "FOS\\TwitterBundle": "" }
},
"target-dir": "FOS/TwitterBundle"
"target-dir": "FOS/TwitterBundle",
"extra": {
"branch-alias": {
"dev-master": "1.1.x-dev"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong. Should be 1.2.x-dev as latest release is alreayd 1.2.2

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof : Are you sure? I can only see a 1.0 branch with one release on it, so I assumed the current master is 1.1.x-dev.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry, I got confused by looking at too many PRs in different bundles in a short time and looked at the wrong package on Packagist

}
}
}
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<phpunit bootstrap="./Tests/bootstrap.php" color="true">
<phpunit bootstrap="./vendor/autoload.php" color="true">

<testsuites>
<testsuite name="FOSTwitterBundle test suite">
Expand Down