Skip to content

Commit

Permalink
Fixing spelling typos and adding filter to the adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
ancarebeca committed Aug 18, 2015
1 parent 451eb1c commit 6894b8c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Adapter/CalendarAdapterInterface.php
Expand Up @@ -9,8 +9,9 @@ interface CalendarAdapterInterface
/**
* @param \Datetime $startDate
* @param \Datetime $endDate
* @param array $filters
*
* @return EventInterface[]
*/
public function getData(\Datetime $startDate, \Datetime $endDate);
public function getData(\Datetime $startDate, \Datetime $endDate, $filters = []);
}
12 changes: 6 additions & 6 deletions README.md
Expand Up @@ -49,9 +49,9 @@ public function registerBundles()

namespace AppBundle\Entity;

use AncaRebeca\FullCalendarBundle\Model\Event as BaseEnvet;
use AncaRebeca\FullCalendarBundle\Model\Event as BaseEvent;

class CalendarEvent extends BaseEnvet
class CalendarEvent extends BaseEvent
{
// Your fields
}
Expand Down Expand Up @@ -91,12 +91,12 @@ class CustomAdapter implements CalendarAdapterInterface

Adding bundle config:

```yaml
```yml
// app/config/config.yml

full_calendar:
adapter_class: AppBundle\Adapter\CustomAdapter
serializer_class: # by defualt AncaRebeca\FullCalendarBundle\Service\Serializer
serializer_class: # by default AncaRebeca\FullCalendarBundle\Service\Serializer
```

### 5. Add styles and scripts in your template <a id="styles-scripts"></a>
Expand Down Expand Up @@ -136,7 +136,7 @@ $> php app/console assets:install web

### 6. Define routes by default <a id="routing"></a>

```yaml
```yml
# app/config/config.yml

ancarebeca_fullcalendar:
Expand Down Expand Up @@ -220,7 +220,7 @@ class CustomSerializer implements SerializerInterface
```
Adding config:
```yaml
```yml
// app/config/config.yml

full_calendar:
Expand Down
5 changes: 3 additions & 2 deletions Service/Calendar.php
Expand Up @@ -29,12 +29,13 @@ public function __construct(SerializerInterface $serializer, CalendarAdapterInte
/**
* @param \Datetime $startDate
* @param \DateTime $endDate
* @param array $filters
*
* @return string json
*/
public function getData(\Datetime $startDate, \DateTime $endDate)
public function getData(\Datetime $startDate, \DateTime $endDate, array $filters = [])
{
$events = $this->adapter->getData($startDate, $endDate);
$events = $this->adapter->getData($startDate, $endDate, $filters);

return $this->serializer->serialize($events);
}
Expand Down
2 changes: 1 addition & 1 deletion spec/Service/CalendarSpec.php
Expand Up @@ -26,7 +26,7 @@ function it_gets_a_json_string(SerializerInterface $serializer, CalendarAdapterI
$events = [];
$json = '{}';

$adapter->getData($startDate, $endDate)->shouldBeCalled()->willReturn($events);
$adapter->getData($startDate, $endDate, [])->shouldBeCalled()->willReturn($events);

$serializer->serialize($events)->shouldBeCalled()->willReturn($json);

Expand Down

0 comments on commit 6894b8c

Please sign in to comment.