Closed pepe95270 closed 8 years ago
Yes, it is possible. First you need to store the user id in your Event
entity. Write your own EventRepository
to customize the queries and filter only the current user. You can use Aggregation to set the current user.
use BladeTester\CalendarBundle\Repository\EventRepositoryInterface;
class EventRepository implements EventRepositoryInterface
{
private $user;
public function setUser(User $user)
{
$this->user = $user;
}
// Your implementation for the interface methods goes here
}
Then declare your repository as a service for the bundle:
blade_tester_calendar.repository.event:
class: Your\CalendarBundle\Repository\EventRepository
factory_service: doctrine
factory_method: getRepository
arguments: [YourCalendarBundle:Event]
calls:
- [setUser, [@current_user]]
This code is an approximation, you may need to find out how to inject the current user.
Hope it helps you, let me know if you need further directions.
Cheers.
Thank you so much for helping :)
I'll look into it and let you know if I succeeded...
Hi again :) I've succeeded but it's not perfect because everyone can still modify everyone's event just by going to the right url...
But anyway it's good enough ;) Thank you
Hi all, It's more a question than an issue but anyway... Is it possible to associate a calendar to a user, so each user could manage it's own calendar ?
Thanks for the great bundle :)