export user data in json

This commit is contained in:
ty kayn 2019-07-05 16:41:33 +02:00
parent 19c7935f58
commit fa5fdfa180
19 changed files with 1127 additions and 528 deletions

View File

@ -7,7 +7,7 @@
<h1>Historique</h1> <h1>Historique</h1>
</div> </div>
<div class="row"> <div class="row">
<div class="col-xs-6"> <div class="col-xs-12">
<div class="sells"> <div class="sells">
<div class="row"> <div class="row">
<div class="col-xs-12 col-sm-4"> <div class="col-xs-12 col-sm-4">
@ -51,7 +51,7 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-xs-6 text-right"> <div class="col-xs-12 ">
<h2>Exporter toutes vos données</h2> <h2>Exporter toutes vos données</h2>
<a class="btn btn-success" href="{{ path('export_all') }}"> <a class="btn btn-success" href="{{ path('export_all') }}">
<i class="fa fa-file-excel-o fa-3x"></i> <i class="fa fa-file-excel-o fa-3x"></i>

View File

@ -80,7 +80,7 @@ code {
@media (min-width: 768px) { @media (min-width: 768px) {
#wrapper { #wrapper {
width: 80%; //width: 80%;
margin: 2em auto; margin: 2em auto;
} }

View File

@ -33,6 +33,7 @@
"sonata-project/admin-bundle": "^3.38", "sonata-project/admin-bundle": "^3.38",
"symfony/monolog-bundle": "^3.1.0", "symfony/monolog-bundle": "^3.1.0",
"symfony/polyfill-apcu": "^1.0", "symfony/polyfill-apcu": "^1.0",
"symfony/serializer": "^4.3",
"symfony/swiftmailer-bundle": "^2.6.4", "symfony/swiftmailer-bundle": "^2.6.4",
"symfony/symfony": "~3.4", "symfony/symfony": "~3.4",
"symfony/templating": "^4.0", "symfony/templating": "^4.0",

View File

@ -14,15 +14,17 @@ use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface; use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Symfony\Component\Serializer\Encoder\JsonEncoder;
use Symfony\Component\Serializer\Encoder\XmlEncoder;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Serializer;
class DefaultController extends Controller class DefaultController extends Controller {
{
private $ownerService; private $ownerService;
private $tokenManager; private $tokenManager;
public function __construct(CsrfTokenManagerInterface $tokenManager = null, OwnerService $ownerService) public function __construct( CsrfTokenManagerInterface $tokenManager = null, OwnerService $ownerService ) {
{
$this->tokenManager = $tokenManager; $this->tokenManager = $tokenManager;
$this->ownerService = $ownerService; $this->ownerService = $ownerService;
} }
@ -30,8 +32,7 @@ class DefaultController extends Controller
/** /**
* @Route("/", name="homepage") * @Route("/", name="homepage")
*/ */
public function indexAction(Request $request) public function indexAction( Request $request ) {
{
$m = $this->getDoctrine()->getManager(); $m = $this->getDoctrine()->getManager();
$userRepo = $m->getRepository( 'AppBundle:User' ); $userRepo = $m->getRepository( 'AppBundle:User' );
$allUsers = $userRepo->findAll(); $allUsers = $userRepo->findAll();
@ -47,8 +48,7 @@ class DefaultController extends Controller
/** /**
* @Route("/dashboard", name="dashboard") * @Route("/dashboard", name="dashboard")
*/ */
public function dashboardAction(Request $request) public function dashboardAction( Request $request ) {
{
$m = $this->getDoctrine()->getManager(); $m = $this->getDoctrine()->getManager();
$currentUser = $this->getUser(); $currentUser = $this->getUser();
@ -83,8 +83,7 @@ class DefaultController extends Controller
/** /**
* envoyer un email * envoyer un email
*/ */
public function emailAction() public function emailAction() {
{
$name = "noble barbare"; $name = "noble barbare";
$message = \Swift_Message::newInstance() $message = \Swift_Message::newInstance()
->setSubject( 'Hello Email' ) ->setSubject( 'Hello Email' )
@ -106,8 +105,7 @@ class DefaultController extends Controller
* get user products * get user products
* @return JsonResponse * @return JsonResponse
*/ */
public function getMyProductsAction() public function getMyProductsAction() {
{
$m = $this->getDoctrine()->getManager(); $m = $this->getDoctrine()->getManager();
@ -143,8 +141,7 @@ class DefaultController extends Controller
* get user expenses * get user expenses
* @return JsonResponse * @return JsonResponse
*/ */
public function getMyExpensesAction() public function getMyExpensesAction() {
{
$m = $this->getDoctrine()->getManager(); $m = $this->getDoctrine()->getManager();
@ -168,11 +165,12 @@ class DefaultController extends Controller
/** /**
* recieve the json containing the expanse config of a user * recieve the json containing the expanse config of a user
*
* @param Request $request * @param Request $request
*
* @return JsonResponse the list of expanses * @return JsonResponse the list of expanses
*/ */
public function saveMyExpensesAction(Request $request) public function saveMyExpensesAction( Request $request ) {
{
$json = json_decode( $request->getContent(), true ); $json = json_decode( $request->getContent(), true );
$currentUser = $this->getUser(); $currentUser = $this->getUser();
@ -235,8 +233,7 @@ class DefaultController extends Controller
* *
* @return JsonResponse * @return JsonResponse
*/ */
public function addSellingAction(Request $request) public function addSellingAction( Request $request ) {
{
$json = json_decode( $request->getContent(), true ); $json = json_decode( $request->getContent(), true );
$currentUser = $this->getUser(); $currentUser = $this->getUser();
@ -318,8 +315,7 @@ class DefaultController extends Controller
* get the history of user's sellings * get the history of user's sellings
* @Route("/history", name="history") * @Route("/history", name="history")
*/ */
public function historyAction() public function historyAction() {
{
$currentUser = $this->getUser(); $currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager(); $m = $this->getDoctrine()->getManager();
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' ); $sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
@ -361,7 +357,7 @@ class DefaultController extends Controller
[ [
'name' => $product->getName(), 'name' => $product->getName(),
'count' => 0, 'count' => 0,
'value' => 0 'value' => 0,
]; ];
} }
@ -383,12 +379,52 @@ class DefaultController extends Controller
] ); ] );
} }
/**
* export user data in JSON
* @return JsonResponse
* @Route("/logged/export-all-json", name="export_all_json")
*/
public function exportJsonAction() {
$currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager();
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
$encoders = [ new XmlEncoder(), new JsonEncoder() ];
$normalizers = [ new ObjectNormalizer() ];
$serializer = new Serializer( $normalizers, $encoders );
$mySellings = $sellingRepo->findByUser( $currentUser->getId() );
$export = [
'export_version' => '1.0',
'user' => $serializer->normalize( $currentUser,
null,
[ 'attributes' => [ 'id', 'username', 'email', 'salt', 'password' ] ] ),
'products' => $serializer->normalize( $currentUser->getProducts(),
null,
[ 'attributes' => [ 'id', 'name', 'price' ] ] ),
'categories' => $serializer->normalize( $currentUser->getCategories(),
null,
[ 'attributes' => [ 'id', 'name' ] ] ),
'series_festivals' => $serializer->normalize( $currentUser->getSeriesFestivals(),
null, ['attributes'=> [
'id', 'name',
]]),
'festivals' => $serializer->normalize( $currentUser->getFestivals(),
null,
[ 'attributes' => [ 'id', 'name', 'chiffreAffaire','fraisInscription','fraisHebergement','fraisTransport','fraisRepas' ] ] ),
'sellings' => $serializer->normalize( $mySellings,
null,
[ 'attributes' => [ 'id', 'amount', 'paidByClient', 'comment', 'gender' ] ] ),
];
return new JsonResponse( $export );
}
/** /**
* export all clients * export all clients
* @Route("/export-all", name="export_all") * @Route("/export-all", name="export_all")
*/ */
public function exportAllAction() public function exportAllAction() {
{
// TODO // TODO
$currentUser = $this->getUser(); $currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager(); $m = $this->getDoctrine()->getManager();
@ -486,8 +522,7 @@ class DefaultController extends Controller
/** /**
* @Route("/set-active-festival/{id}", name="set_active_festival") * @Route("/set-active-festival/{id}", name="set_active_festival")
*/ */
public function setActiveFestivalAction($id) public function setActiveFestivalAction( $id ) {
{
$currentUser = $this->getUser(); $currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager(); $m = $this->getDoctrine()->getManager();
$repo = $m->getRepository( 'AppBundle:Festival' ); $repo = $m->getRepository( 'AppBundle:Festival' );
@ -503,8 +538,7 @@ class DefaultController extends Controller
/** /**
* @Route("/import", name="import") * @Route("/import", name="import")
*/ */
public function importAction() public function importAction() {
{
$currentUser = $this->getUser(); $currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager(); $m = $this->getDoctrine()->getManager();
$sellingRepo = $m->getRepository( 'AppBundle:SellRecord' ); $sellingRepo = $m->getRepository( 'AppBundle:SellRecord' );
@ -518,8 +552,7 @@ class DefaultController extends Controller
/** /**
* @Route("/previsionnel", name="previsionnel") * @Route("/previsionnel", name="previsionnel")
*/ */
public function previsionnelAction() public function previsionnelAction() {
{
// $currentUser = $this->getUser(); // $currentUser = $this->getUser();
// $m = $this->getDoctrine()->getManager(); // $m = $this->getDoctrine()->getManager();
// $sellingRepo = $m->getRepository('AppBundle:SellRecord'); // $sellingRepo = $m->getRepository('AppBundle:SellRecord');
@ -534,8 +567,7 @@ class DefaultController extends Controller
* import lots of products at once * import lots of products at once
* @Route("/mass-create", name="mass_create") * @Route("/mass-create", name="mass_create")
*/ */
public function massCreateAction(Request $request) public function massCreateAction( Request $request ) {
{
$currentUser = $this->getUser(); $currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager(); $m = $this->getDoctrine()->getManager();

0
src/AppBundle/Entity/ExpenseKind.php Executable file → Normal file
View File

View File

@ -0,0 +1,200 @@
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* ExpenseKind, for previsional compta
*
* @ORM\Table(name="expense_kind")
* @ORM\Entity(repositoryClass="AppBundle\Repository\ExpenseKindRepository")
*/
class ExpenseKind
{
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* @var int|null
*
* @ORM\Column(name="delay", type="integer", nullable=true)
*/
private $delay;
/**
* line enabled to calculate on
*
* @ORM\Column(name="enabled", type="boolean", nullable=true)
*/
private $enabled;
/**
* @var int|null
*
* @ORM\Column(name="repeatitions", type="integer", nullable=true)
*/
private $repeatitions;
/**
* @var float
*
* @ORM\Column(name="amount", type="float")
*/
private $amount;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="expenses")
*/
private $user;
/**
* @return int|null
*/
public function getEnabled()
{
return $this->enabled;
}
/**
* @param int|null $enabled
*/
public function setEnabled($enabled)
{
$this->enabled = $enabled;
}
/**
* Get id.
*
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @return mixed
*/
public function getUser()
{
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser($user)
{
$this->user = $user;
}
/**
* Set name.
*
* @param string $name
*
* @return ExpenseKind
*/
public function setName($name)
{
$this->name = $name;
return $this;
}
/**
* Get name.
*
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* Set delay.
*
* @param int|null $delay
*
* @return ExpenseKind
*/
public function setDelay($delay = null)
{
$this->delay = $delay;
return $this;
}
/**
* Get delay.
*
* @return int|null
*/
public function getDelay()
{
return $this->delay;
}
/**
* Set repeatitions.
*
* @param int|null $repeatitions
*
* @return ExpenseKind
*/
public function setRepeatitions($repeatitions = null)
{
$this->repeatitions = $repeatitions;
return $this;
}
/**
* Get repeatitions.
*
* @return int|null
*/
public function getRepeatitions()
{
return $this->repeatitions;
}
/**
* Set amount.
*
* @param float $amount
*
* @return ExpenseKind
*/
public function setAmount($amount)
{
$this->amount = $amount;
return $this;
}
/**
* Get amount.
*
* @return float
*/
public function getAmount()
{
return $this->amount;
}
}

0
src/AppBundle/Entity/Festival.php Executable file → Normal file
View File

View File

@ -40,7 +40,7 @@ class Festival {
/** /**
* @var \stdClass * @var \stdClass
* *
* @ORM\OneToMany(targetEntity="AppBundle\Entity\SellRecord",mappedBy="festival") * @ORM\OneToMany(targetEntity="AppBundle\Entity\SellRecord",mappedBy="festival", cascade={"remove"})
*/ */
private $sellRecords; private $sellRecords;
@ -48,6 +48,10 @@ class Festival {
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="festivals") * @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="festivals")
*/ */
private $user; private $user;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\SerieFestival", inversedBy="festivals")
*/
private $serieFestival;
/** /**
* @var * @var
@ -83,11 +87,42 @@ class Festival {
private $fraisRepas; private $fraisRepas;
public function __toString() {
return $this->getName();
}
/**
* @return mixed
*/
public function getSerieFestival()
{
return $this->serieFestival;
}
/**
* @param mixed $serieFestival
*/
public function setSerieFestival($serieFestival)
{
$this->serieFestival = $serieFestival;
}
/** /**
* array usable by js * array usable by js
* @return array * @return array
*/ */
public function makeArray(){ public function makeArray(){
$sellRecords = $this->getSellRecords();
$soldItems = [];
foreach ( $sellRecords as $sell_record ) {
foreach ( $sell_record->getProductsSold() as $sold ) {
if(!isset($soldItems[$sold->getProduct()->getId()])){
$soldItems[$sold->getProduct()->getId()] = 0;
}
$soldItems[$sold->getProduct()->getId()]++;
}
}
return [ return [
'id' => $this->getId(), 'id' => $this->getId(),
'name' => $this->getName(), 'name' => $this->getName(),
@ -97,6 +132,7 @@ class Festival {
'clientsCount' => count($this->getSellRecords()), 'clientsCount' => count($this->getSellRecords()),
'fondDeCaisseAvant' => $this->getFondDeCaisseAvant(), 'fondDeCaisseAvant' => $this->getFondDeCaisseAvant(),
'fondDeCaisseApres' => $this->getFondDeCaisseApres(), 'fondDeCaisseApres' => $this->getFondDeCaisseApres(),
'sold' => $soldItems,
]; ];
} }

0
src/AppBundle/Entity/Product.php Executable file → Normal file
View File

View File

@ -43,7 +43,7 @@ class Product {
*/ */
private $user; private $user;
/** /**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="product") * @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="product", cascade={"remove"})
*/ */
private $productsSold; private $productsSold;

0
src/AppBundle/Entity/ProductCategory.php Executable file → Normal file
View File

View File

@ -21,11 +21,11 @@ class ProductCategory {
private $name; private $name;
/** /**
* @ORM\OneToMany(targetEntity="Product", mappedBy="category") * @ORM\OneToMany(targetEntity="Product", mappedBy="category", cascade={"remove"})
*/ */
private $products; private $products;
/** /**
* @ORM\OneToMany(targetEntity="ProductSold", mappedBy="product") * @ORM\OneToMany(targetEntity="ProductSold", mappedBy="product", cascade={"remove"})
*/ */
private $productsSold; private $productsSold;

0
src/AppBundle/Entity/ProductSold.php Executable file → Normal file
View File

0
src/AppBundle/Entity/SellRecord.php Executable file → Normal file
View File

View File

@ -24,7 +24,7 @@ class SellRecord {
private $gender; private $gender;
/** /**
* liste des produits de la vente * liste des produits de la vente
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="sellRecords") * @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="sellRecords", cascade={"remove", "persist","detach"})
*/ */
private $productsSold; private $productsSold;

33
src/AppBundle/Entity/SerieFestival.php Executable file → Normal file
View File

@ -127,4 +127,37 @@ class SerieFestival {
{ {
$this->dateCreation = $dateCreation; $this->dateCreation = $dateCreation;
} }
/**
* Constructor
*/
public function __construct()
{
$this->festivals = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add festival.
*
* @param \AppBundle\Entity\Festival $festival
*
* @return SerieFestival
*/
public function addFestival(\AppBundle\Entity\Festival $festival)
{
$this->festivals[] = $festival;
return $this;
}
/**
* Remove festival.
*
* @param \AppBundle\Entity\Festival $festival
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeFestival(\AppBundle\Entity\Festival $festival)
{
return $this->festivals->removeElement($festival);
}
} }

View File

@ -0,0 +1,130 @@
<?php
namespace AppBundle\Entity;
use AppBundle\Traits\Commentable;
use Doctrine\ORM\Mapping as ORM;
/**
* Festival
*
* @ORM\Table(name="serieFestival")
* @ORM\Entity(repositoryClass="AppBundle\Repository\FestivalRepository")
*/
class SerieFestival {
/**
* @var int
*
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @var string
*
* @ORM\Column(name="name", type="string", length=255)
*/
private $name;
/**
* variabilised products sold
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Festival", mappedBy="serieFestival")
*/
private $festivals;
/**
* @var \DateTime
*
* @ORM\Column(name="dateCreation", type="datetime")
*/
private $dateCreation;
/**
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="seriesFestivals")
*/
private $user;
/**
* @return mixed
*/
public function getUser()
{
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser($user)
{
$this->user = $user;
}
/**
* @return int
*/
public function getId()
{
return $this->id;
}
/**
* @param int $id
*/
public function setId($id)
{
$this->id = $id;
}
/**
* @return string
*/
public function getName()
{
return $this->name;
}
/**
* @param string $name
*/
public function setName($name)
{
$this->name = $name;
}
/**
* @return mixed
*/
public function getFestivals()
{
return $this->festivals;
}
/**
* @param mixed $festivals
*/
public function setFestivals($festivals)
{
$this->festivals = $festivals;
}
/**
* @return \DateTime
*/
public function getDateCreation()
{
return $this->dateCreation;
}
/**
* @param \DateTime $dateCreation
*/
public function setDateCreation($dateCreation)
{
$this->dateCreation = $dateCreation;
}
}

83
src/AppBundle/Entity/User.php Executable file → Normal file
View File

@ -35,6 +35,10 @@ class User extends BaseUser {
* @ORM\Column(name="google_id", type="string", length=255, nullable=true) * @ORM\Column(name="google_id", type="string", length=255, nullable=true)
*/ */
private $googleId; private $googleId;
/**
* @ORM\Column(name="mastodon_id", type="string", length=255, nullable=true)
*/
private $mastodonId;
private $googleAccessToken; private $googleAccessToken;
/** /**
@ -76,11 +80,12 @@ class User extends BaseUser {
private $averageMonthlyEarnings; private $averageMonthlyEarnings;
/** /**
* available money, for previsionnel calculation
* @ORM\Column(name="disponibility", type="float", nullable=true) * @ORM\Column(name="disponibility", type="float", nullable=true)
*/ */
private $disponibility; private $disponibility;
/** /**
* variabilised products sold * expenses by kind, for previsionnel
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ExpenseKind", mappedBy="user") * @ORM\OneToMany(targetEntity="AppBundle\Entity\ExpenseKind", mappedBy="user")
*/ */
private $expenses; private $expenses;
@ -468,4 +473,80 @@ class User extends BaseUser {
public function getDisqusId() { public function getDisqusId() {
return $this->disqusId; return $this->disqusId;
} }
/**
* Set mastodonId.
*
* @param string|null $mastodonId
*
* @return User
*/
public function setMastodonId($mastodonId = null)
{
$this->mastodonId = $mastodonId;
return $this;
}
/**
* Get mastodonId.
*
* @return string|null
*/
public function getMastodonId()
{
return $this->mastodonId;
}
/**
* Add seriesFestival.
*
* @param \AppBundle\Entity\SerieFestival $seriesFestival
*
* @return User
*/
public function addSeriesFestival(\AppBundle\Entity\SerieFestival $seriesFestival)
{
$this->seriesFestivals[] = $seriesFestival;
return $this;
}
/**
* Remove seriesFestival.
*
* @param \AppBundle\Entity\SerieFestival $seriesFestival
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeSeriesFestival(\AppBundle\Entity\SerieFestival $seriesFestival)
{
return $this->seriesFestivals->removeElement($seriesFestival);
}
/**
* Add expense.
*
* @param \AppBundle\Entity\ExpenseKind $expense
*
* @return User
*/
public function addExpense(\AppBundle\Entity\ExpenseKind $expense)
{
$this->expenses[] = $expense;
return $this;
}
/**
* Remove expense.
*
* @param \AppBundle\Entity\ExpenseKind $expense
*
* @return boolean TRUE if this collection contained the specified element, FALSE otherwise.
*/
public function removeExpense(\AppBundle\Entity\ExpenseKind $expense)
{
return $this->expenses->removeElement($expense);
}
} }

View File

@ -35,9 +35,16 @@ class User extends BaseUser {
* @ORM\Column(name="google_id", type="string", length=255, nullable=true) * @ORM\Column(name="google_id", type="string", length=255, nullable=true)
*/ */
private $googleId; private $googleId;
/**
* @ORM\Column(name="mastodon_id", type="string", length=255, nullable=true)
*/
private $mastodonId;
private $googleAccessToken; private $googleAccessToken;
/**
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\ProductCategory", inversedBy="users")
*/
private $categories;
/** /**
* templates products * templates products
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Product", mappedBy="user") * @ORM\OneToMany(targetEntity="AppBundle\Entity\Product", mappedBy="user")
@ -54,6 +61,11 @@ class User extends BaseUser {
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Festival", mappedBy="user") * @ORM\OneToMany(targetEntity="AppBundle\Entity\Festival", mappedBy="user")
*/ */
private $festivals; private $festivals;
/**
* series of festivals
* @ORM\OneToMany(targetEntity="AppBundle\Entity\SerieFestival", mappedBy="user")
*/
private $seriesFestivals;
/** /**
* current festival we are recording sellings for * current festival we are recording sellings for
@ -61,10 +73,84 @@ class User extends BaseUser {
*/ */
private $activeFestival; private $activeFestival;
//expenses previsionnel configs
/** /**
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\ProductCategory", inversedBy="users") * @ORM\Column(name="averageMonthlyEarnings", type="float", nullable=true)
*/ */
private $categories; private $averageMonthlyEarnings;
/**
* available money, for previsionnel calculation
* @ORM\Column(name="disponibility", type="float", nullable=true)
*/
private $disponibility;
/**
* expenses by kind, for previsionnel
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ExpenseKind", mappedBy="user")
*/
private $expenses;
/**
* @return mixed
*/
public function getAverageMonthlyEarnings()
{
return $this->averageMonthlyEarnings;
}
/**
* @param mixed $averageMonthlyEarnings
*/
public function setAverageMonthlyEarnings($averageMonthlyEarnings)
{
$this->averageMonthlyEarnings = $averageMonthlyEarnings;
}
/**
* @return mixed
*/
public function getDisponibility()
{
return $this->disponibility;
}
/**
* @param mixed $disponibility
*/
public function setDisponibility($disponibility)
{
$this->disponibility = $disponibility;
}
/**
* @return mixed
*/
public function getSeriesFestivals()
{
return $this->seriesFestivals;
}
/**
* @param mixed $seriesFestivals
*/
public function setSeriesFestivals($seriesFestivals)
{
$this->seriesFestivals = $seriesFestivals;
}
/**
* @return mixed
*/
public function getExpenses()
{
return $this->expenses;
}
/**
* @param mixed $expenses
*/
public function setExpenses($expenses)
{
$this->expenses = $expenses;
}
/** /**
* @return mixed * @return mixed