add debug for record

This commit is contained in:
Kayn Ty 2018-04-17 12:10:21 +02:00
parent 013c990540
commit 8e4f494035
113 changed files with 977 additions and 101 deletions

0
.gitignore vendored Normal file → Executable file
View File

0
README.md Normal file → Executable file
View File

0
app/.htaccess Normal file → Executable file
View File

0
app/AppCache.php Normal file → Executable file
View File

0
app/AppKernel.php Normal file → Executable file
View File

0
app/Resources/FOSUserBundle/views/layout.html.twig Normal file → Executable file
View File

View File

View File

0
app/Resources/HWIOAuthBundle/views/layout.html.twig Normal file → Executable file
View File

0
app/Resources/views/base.html.twig Normal file → Executable file
View File

0
app/Resources/views/default/footer.html.twig Normal file → Executable file
View File

0
app/Resources/views/default/header.html.twig Normal file → Executable file
View File

0
app/Resources/views/default/index.html.twig Normal file → Executable file
View File

0
app/Resources/views/default/login-choices.html.twig Normal file → Executable file
View File

0
app/Resources/views/default/main-screen.html.twig Normal file → Executable file
View File

0
app/Resources/views/festival/edit.html.twig Normal file → Executable file
View File

0
app/Resources/views/festival/index.html.twig Normal file → Executable file
View File

0
app/Resources/views/festival/new.html.twig Normal file → Executable file
View File

0
app/Resources/views/festival/show.html.twig Normal file → Executable file
View File

13
app/Resources/views/logged/angular/current.html.twig Normal file → Executable file
View File

@ -1,5 +1,16 @@
{% verbatim %} {% verbatim %}
<div class="current-selling"> <div class="current-selling">
<div class="well">
<button class="btn btn-primary btn-block" id="validate_selling" ng-click="sendForm()"
ng-disabled="!paidAmount">
<i class="fa fa-check"></i>
Valider
</button>
<pre>
{{lesParams|json}}
</pre>
</div>
<form action="#"> <form action="#">
Festival: Festival:
<input type="text" ng-model="activeFestival.name" placeholder="nom du festival"> <input type="text" ng-model="activeFestival.name" placeholder="nom du festival">
@ -7,7 +18,7 @@
<hr> <hr>
Client actuel: Client actuel:
{{ activeSelling.length }} produits {{ activeSelling.length }} produits
<input type="text" ng-model="commentaire" placeholder="commentaire"> <input type="text" ng-model="sellingComment" placeholder="commentaire">
<hr> <hr>
<ul> <ul>

View File

@ -10,6 +10,10 @@
<span class="badge"> <span class="badge">
{{ p.price }} {{ p.price }}
</span> </span>
<span class="badge">
c
{{ c.id }}
</span>
</button> </button>
</div> </div>
{% endverbatim %} {% endverbatim %}

View File

0
app/Resources/views/logged/angular/messages.html.twig Normal file → Executable file
View File

0
app/Resources/views/logged/angular/paused.html.twig Normal file → Executable file
View File

0
app/Resources/views/logged/angular/recent.html.twig Normal file → Executable file
View File

0
app/Resources/views/logged/caisse-main.html.twig Normal file → Executable file
View File

0
app/Resources/views/logged/dashboard.html.twig Normal file → Executable file
View File

0
app/Resources/views/product/edit.html.twig Normal file → Executable file
View File

0
app/Resources/views/product/new.html.twig Normal file → Executable file
View File

0
app/Resources/views/product/show.html.twig Normal file → Executable file
View File

0
app/Resources/views/productcategory/edit.html.twig Normal file → Executable file
View File

0
app/Resources/views/productcategory/index.html.twig Normal file → Executable file
View File

0
app/Resources/views/productcategory/new.html.twig Normal file → Executable file
View File

0
app/Resources/views/productcategory/show.html.twig Normal file → Executable file
View File

0
app/Resources/views/sellrecord/edit.html.twig Normal file → Executable file
View File

0
app/Resources/views/sellrecord/index.html.twig Normal file → Executable file
View File

0
app/Resources/views/sellrecord/new.html.twig Normal file → Executable file
View File

0
app/Resources/views/sellrecord/show.html.twig Normal file → Executable file
View File

0
app/config/config.yml Normal file → Executable file
View File

0
app/config/config_dev.yml Normal file → Executable file
View File

0
app/config/config_prod.yml Normal file → Executable file
View File

0
app/config/config_test.yml Normal file → Executable file
View File

0
app/config/parameters.yml.dist Normal file → Executable file
View File

0
app/config/routing.yml Normal file → Executable file
View File

0
app/config/routing_dev.yml Normal file → Executable file
View File

0
app/config/security.yml Normal file → Executable file
View File

0
app/config/services.yml Normal file → Executable file
View File

0
assets/css/app.scss Normal file → Executable file
View File

0
assets/css/pages/demo.scss Normal file → Executable file
View File

1
assets/css/pages/global.scss Normal file → Executable file
View File

@ -11,4 +11,5 @@
height: 100vh; height: 100vh;
position: fixed; position: fixed;
overflow: hidden; overflow: hidden;
z-index: -1;
} }

0
assets/css/pages/libs.scss Normal file → Executable file
View File

0
assets/css/pages/responsive.scss Normal file → Executable file
View File

0
assets/css/pages/special.scss Normal file → Executable file
View File

0
assets/css/split/custom_vars.scss Normal file → Executable file
View File

0
assets/css/split/formulaires.scss Normal file → Executable file
View File

0
assets/js/app.js Normal file → Executable file
View File

13
assets/js/parts/main.js Normal file → Executable file
View File

@ -5,15 +5,17 @@ angular
.controller('CaisseCtrl', ['$scope', '$http', function ($scope, $http, stuff) { .controller('CaisseCtrl', ['$scope', '$http', function ($scope, $http, stuff) {
$scope.productsFromDB = []; // loaded products $scope.productsFromDB = []; // loaded products
$scope.categories = []; // product categories $scope.categories = []; // product categories
$scope.commentaire = []; // comment about the client or the current selling $scope.sellingComment = "sellingComment"; // comment about the client or the current selling
$scope.initLoadDone = false; // becames true after first init of product loading $scope.initLoadDone = false; // becames true after first init of product loading
$scope.recentSellings = []; $scope.recentSellings = [];
$scope.lesParams = {};
$scope.paidAmount = 20;
$scope.pausedSelling = []; $scope.pausedSelling = [];
$scope.activeSelling = []; // list of products to sell $scope.activeSelling = []; // list of products to sell
$scope.activeFestival = { // an event where selling take place $scope.activeFestival = { // an event where selling take place
name : "le festival", name : "le festival",
dateCreation: new Date(), dateCreation: new Date(),
commentaire : "" commentaire : "le com de festival"
}; };
/** /**
* get the sum of products prices * get the sum of products prices
@ -54,6 +56,7 @@ angular
$scope.categories = rep.data.categories; $scope.categories = rep.data.categories;
$scope.recentSellings = rep.data.history; $scope.recentSellings = rep.data.history;
$scope.initLoadDone = true; $scope.initLoadDone = true;
$scope.addProduct($scope.categories[0].products[0])
}, (err) => { }, (err) => {
console.log(err); console.log(err);
$scope.initLoadDone = true; $scope.initLoadDone = true;
@ -69,16 +72,17 @@ angular
}; };
$scope.clearCurrentSelling = function () { $scope.clearCurrentSelling = function () {
$scope.paidAmount = 0; $scope.paidAmount = 0;
$scope.commentaire = ""; $scope.sellingComment = "";
$scope.activeSelling = []; $scope.activeSelling = [];
}; };
$scope.sendForm = function () { $scope.sendForm = function () {
let lesParams = { let lesParams = {
paidByClient : $scope.paidAmount, paidByClient : $scope.paidAmount,
sellingComment: $scope.commentaire, sellingComment: $scope.sellingComment,
activeSelling : $scope.activeSelling, activeSelling : $scope.activeSelling,
activeFestival: $scope.activeFestival activeFestival: $scope.activeFestival
}; };
$scope.lesParams = lesParams;
$http({ $http({
method : 'POST', method : 'POST',
url : 'add-selling', url : 'add-selling',
@ -87,6 +91,7 @@ angular
}, },
data : lesParams // pass in data as strings data : lesParams // pass in data as strings
}).then(function (rep) { }).then(function (rep) {
$scope.clearCurrentSelling();
console.log(rep); console.log(rep);
if (!rep.success) { if (!rep.success) {
// if not successful, bind errors to error variables // if not successful, bind errors to error variables

0
composer.json Normal file → Executable file
View File

0
composer.lock generated Normal file → Executable file
View File

0
install.sh Normal file → Executable file
View File

0
package.json Normal file → Executable file
View File

0
phpunit.xml.dist Normal file → Executable file
View File

0
src/.htaccess Normal file → Executable file
View File

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

27
src/AppBundle/Controller/DefaultController.php Normal file → Executable file
View File

@ -120,11 +120,7 @@ class DefaultController extends Controller {
* @return JsonResponse * @return JsonResponse
*/ */
public function addSellingAction( Request $request ) { public function addSellingAction( Request $request ) {
// var_dump( $request->request ); $json = json_decode( $request->getContent(), true );
// die();
$json = json_decode( $request->getContent(), true );
// var_dump( $json );
// die();
$currentUser = $this->getUser(); $currentUser = $this->getUser();
$m = $this->getDoctrine()->getManager(); $m = $this->getDoctrine()->getManager();
$newSellRecord = new SellRecord(); $newSellRecord = new SellRecord();
@ -141,24 +137,29 @@ class DefaultController extends Controller {
$productsModelsByID[ $product->getId() ] = $product; $productsModelsByID[ $product->getId() ] = $product;
} }
$sumAmount = 0;
foreach ( $json[ 'activeSelling' ] as $record ) { foreach ( $json[ 'activeSelling' ] as $record ) {
var_dump( $categoriesByID[ $record[ 'category' ] ] ); var_dump( $record[ 'category' ] );
var_dump( $categoriesByID[ $record[ 'category' ] ]->getName() );
$productModel = $productsModelsByID[ $record[ 'id' ] ];
$newProductSold = new ProductSold(); $newProductSold = new ProductSold();
// $newProductSold->setCategory( $categoriesByID[ $record[ 'category' ] ] ); // $newProductSold->setCategory( $productModel->getCategory() );
// $newProductSold->setCategory( 1 );
$newProductSold->setName( $record[ 'name' ] ); $newProductSold->setName( $record[ 'name' ] );
$newProductSold->setPrice( $record[ 'price' ] ); $newProductSold->setPrice( $record[ 'price' ] );
$newProductSold->setProduct( $productsModelsByID[ $record[ 'id' ] ] ); $sumAmount += $record[ 'price' ];
$newProductSold->setUser( $currentUser ); // $newProductSold->setProduct( $productsModelsByID[ $record[ 'id' ] ] );
$newProductSold->setUser( $currentUser->getId() );
$newProductSold->setSellRecords( $newSellRecord ); $newProductSold->setSellRecords( $newSellRecord );
// link selling record with user, festival // link selling record with user, festival
$currentUser->addProductsSold( $newProductSold ); // $currentUser->addProductsSold( $newProductSold );
// persist all // persist all
$m->persist( $newProductSold ); $m->persist( $newProductSold );
} }
$newSellRecord->setPaidByClient( 0 ); // $newSellRecord->setPaidByClient( 0 );
$newSellRecord->setAmount( 42 ); $newSellRecord->setAmount( $sumAmount );
$newSellRecord->setDate( new \DateTime() ); $newSellRecord->setDate( new \DateTime() );
// $newSellRecord->setPaidByClient( $json[ 'paidByClient' ] ); $newSellRecord->setPaidByClient( $json[ 'paidByClient' ] );
$currentUser->addSellRecords( $newSellRecord ); $currentUser->addSellRecords( $newSellRecord );

0
src/AppBundle/Controller/FestivalController.php Normal file → Executable file
View File

0
src/AppBundle/Controller/ProductCategoryController.php Normal file → Executable file
View File

0
src/AppBundle/Controller/ProductController.php Normal file → Executable file
View File

0
src/AppBundle/Controller/SellRecordController.php Normal file → Executable file
View File

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

@ -116,5 +116,35 @@ class Festival {
public function getSellRecords() { public function getSellRecords() {
return $this->sellRecords; return $this->sellRecords;
} }
} /**
* Constructor
*/
public function __construct()
{
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*
* @return Festival
*/
public function addSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
{
$this->sellRecords[] = $sellRecord;
return $this;
}
/**
* Remove sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*/
public function removeSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
{
$this->sellRecords->removeElement($sellRecord);
}
}

View File

@ -0,0 +1,150 @@
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* Festival
*
* @ORM\Table(name="festival")
* @ORM\Entity(repositoryClass="AppBundle\Repository\FestivalRepository")
*/
class Festival {
/**
* @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 \DateTime
*
* @ORM\Column(name="dateCreation", type="datetime")
*/
private $dateCreation;
/**
* @var \stdClass
*
* @ORM\OneToMany(targetEntity="AppBundle\Entity\SellRecord",mappedBy="festival")
*/
private $sellRecords;
/**
* Get id
*
* @return int
*/
public function getId() {
return $this->id;
}
/**
* Set name
*
* @param string $name
*
* @return Festival
*/
public function setName( $name ) {
$this->name = $name;
return $this;
}
/**
* Get name
*
* @return string
*/
public function getName() {
return $this->name;
}
/**
* Set dateCreation
*
* @param \DateTime $dateCreation
*
* @return Festival
*/
public function setDateCreation( $dateCreation ) {
$this->dateCreation = $dateCreation;
return $this;
}
/**
* Get dateCreation
*
* @return \DateTime
*/
public function getDateCreation() {
return $this->dateCreation;
}
/**
* Set sellRecords
*
* @param \stdClass $sellRecords
*
* @return Festival
*/
public function setSellRecords( $sellRecords ) {
$this->sellRecords = $sellRecords;
return $this;
}
/**
* Get sellRecords
*
* @return \stdClass
*/
public function getSellRecords() {
return $this->sellRecords;
}
/**
* Constructor
*/
public function __construct()
{
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*
* @return Festival
*/
public function addSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
{
$this->sellRecords[] = $sellRecord;
return $this;
}
/**
* Remove sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*/
public function removeSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
{
$this->sellRecords->removeElement($sellRecord);
}
}

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

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

@ -2,6 +2,8 @@
namespace AppBundle\Entity; namespace AppBundle\Entity;
use AppBundle\Traits\Commentable;
use AppBundle\Traits\Sellable;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
@ -20,18 +22,51 @@ class Product {
*/ */
private $name; private $name;
/** /**
* @ORM\Column(type="decimal", scale=2, nullable=true) * @ORM\Column(type="string", length=256)
*/ */
private $price; private $image;
/** /**
* @ORM\ManyToOne(targetEntity="ProductCategory", inversedBy="products") * @ORM\ManyToOne(targetEntity="ProductCategory", inversedBy="products")
*/ */
private $category; private $category;
/** /**
* @ORM\OneToMany(targetEntity="SellRecord", mappedBy="products") * @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="products")
*/ */
private $sellRecords; private $user;
use Sellable;
use Commentable;
/**
* @return mixed
*/
public function getImage() {
return $this->image;
}
/**
* @param mixed $image
*/
public function setImage( $image ) {
$this->image = $image;
}
/**
* @return mixed
*/
public function getUser() {
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser( $user ) {
$this->user = $user;
}
/** /**
* @return mixed * @return mixed
@ -88,45 +123,24 @@ class Product {
public function setCategory( ProductCategory $category ) { public function setCategory( ProductCategory $category ) {
$this->category = $category; $this->category = $category;
} }
/**
* Constructor
*/
public function __construct()
{
$this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
}
/** /**
* Add sellRecord * Constructor
* */
* @param \AppBundle\Entity\SellRecord $sellRecord public function __construct() {
* $this->sellRecords = new \Doctrine\Common\Collections\ArrayCollection();
* @return Product }
*/
public function addSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
{
$this->sellRecords[] = $sellRecord;
return $this; /**
} * Add sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*
* @return Product
*/
public function addSellRecord( \AppBundle\Entity\SellRecord $sellRecord ) {
$this->sellRecords[] = $sellRecord;
/** return $this;
* Remove sellRecord }
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*/
public function removeSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
{
$this->sellRecords->removeElement($sellRecord);
}
/**
* Get sellRecords
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getSellRecords()
{
return $this->sellRecords;
}
} }

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

@ -118,4 +118,28 @@ class ProductCategory {
public function removeProduct( \AppBundle\Entity\Product $product ) { public function removeProduct( \AppBundle\Entity\Product $product ) {
$this->products->removeElement( $product ); $this->products->removeElement( $product );
} }
/**
* Add user
*
* @param \AppBundle\Entity\User $user
*
* @return ProductCategory
*/
public function addUser(\AppBundle\Entity\User $user)
{
$this->users[] = $user;
return $this;
}
/**
* Remove user
*
* @param \AppBundle\Entity\User $user
*/
public function removeUser(\AppBundle\Entity\User $user)
{
$this->users->removeElement($user);
}
} }

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

@ -25,6 +25,29 @@ class ProductCategory {
*/ */
private $products; private $products;
/**
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\User", mappedBy="categories")
*/
private $users;
public function __toString() {
return $this->getName() . ' (' . count( $this->getProducts() ) . ' produits)';
}
/**
* @return mixed
*/
public function getUsers() {
return $this->users;
}
/**
* @param mixed $users
*/
public function setUsers( $users ) {
$this->users = $users;
}
/** /**
* @return mixed * @return mixed
*/ */
@ -95,4 +118,28 @@ class ProductCategory {
public function removeProduct( \AppBundle\Entity\Product $product ) { public function removeProduct( \AppBundle\Entity\Product $product ) {
$this->products->removeElement( $product ); $this->products->removeElement( $product );
} }
/**
* Add user
*
* @param \AppBundle\Entity\User $user
*
* @return ProductCategory
*/
public function addUser(\AppBundle\Entity\User $user)
{
$this->users[] = $user;
return $this;
}
/**
* Remove user
*
* @param \AppBundle\Entity\User $user
*/
public function removeUser(\AppBundle\Entity\User $user)
{
$this->users->removeElement($user);
}
} }

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

@ -8,6 +8,13 @@ use Doctrine\ORM\Mapping as ORM;
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductRepository") * @ORM\Entity(repositoryClass="AppBundle\Repository\ProductRepository")
*/ */
class ProductSold extends Product { class ProductSold extends Product {
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/** /**
* the stack of products for one client at one time * the stack of products for one client at one time
@ -21,6 +28,7 @@ class ProductSold extends Product {
*/ */
private $user; private $user;
/** /**
* references the product from whom this line is inspired * references the product from whom this line is inspired
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Product", inversedBy="productsSold") * @ORM\ManyToOne(targetEntity="AppBundle\Entity\Product", inversedBy="productsSold")
@ -34,29 +42,15 @@ class ProductSold extends Product {
/** /**
* @return mixed * @return mixed
*/ */
public function getCategory() { public function getId() {
return $this->category; return $this->id;
} }
/** /**
* @param mixed $category * @param mixed $id
*/ */
public function setCategory( $category ) { public function setId( $id ) {
$this->category = $category; $this->id = $id;
}
/**
* @return mixed
*/
public function getSellRecords() {
return $this->sellRecords;
}
/**
* @param mixed $sellRecords
*/
public function setSellRecords( $sellRecords ) {
$this->sellRecords = $sellRecords;
} }
/** /**
@ -76,15 +70,58 @@ class ProductSold extends Product {
/** /**
* @return mixed * @return mixed
*/ */
public function getProduct() { public function getCategory() {
return $this->product; return $this->category;
} }
/** /**
* @param mixed $product * @param mixed $category
*/ */
public function setProduct( $product ) { public function setCategory( ProductCategory $category ) {
$this->product = $product; $this->category = $category;
} }
/**
* Set sellRecords
*
* @param \AppBundle\Entity\SellRecord $sellRecords
*
* @return ProductSold
*/
public function setSellRecords( SellRecord $sellRecords = null ) {
$this->sellRecords = $sellRecords;
return $this;
}
/**
* Get sellRecords
*
* @return \AppBundle\Entity\SellRecord
*/
public function getSellRecords() {
return $this->sellRecords;
}
/**
* Set product
*
* @param \AppBundle\Entity\Product $product
*
* @return ProductSold
*/
public function setProduct( Product $product = null ) {
$this->product = $product;
return $this;
}
/**
* Get product
*
* @return \AppBundle\Entity\Product
*/
public function getProduct() {
return $this->product;
}
} }

View File

@ -0,0 +1,112 @@
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass="AppBundle\Repository\ProductRepository")
*/
class ProductSold extends Product {
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* the stack of products for one client at one time
* @ORM\ManyToOne(targetEntity="SellRecord", inversedBy="productsSold")
*/
public $sellRecords;
/**
* person who recorded the sell
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="productsSold")
*/
private $user;
/**
* references the product from whom this line is inspired
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Product", inversedBy="productsSold")
*/
private $product;
/**
* @ORM\ManyToOne(targetEntity="ProductCategory", inversedBy="products")
*/
private $category;
/**
* @return mixed
*/
public function getUser() {
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser( $user ) {
$this->user = $user;
}
/**
* @return mixed
*/
public function getCategory() {
return $this->category;
}
/**
* @param mixed $category
*/
public function setCategory( $category ) {
$this->category = $category;
}
/**
* Set sellRecords
*
* @param \AppBundle\Entity\SellRecord $sellRecords
*
* @return ProductSold
*/
public function setSellRecords( \AppBundle\Entity\SellRecord $sellRecords = null ) {
$this->sellRecords = $sellRecords;
return $this;
}
/**
* Get sellRecords
*
* @return \AppBundle\Entity\SellRecord
*/
public function getSellRecords() {
return $this->sellRecords;
}
/**
* Set product
*
* @param \AppBundle\Entity\Product $product
*
* @return ProductSold
*/
public function setProduct( \AppBundle\Entity\Product $product = null ) {
$this->product = $product;
return $this;
}
/**
* Get product
*
* @return \AppBundle\Entity\Product
*/
public function getProduct() {
return $this->product;
}
}

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

@ -14,7 +14,7 @@ class SellRecord {
/** /**
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue * @ORM\GeneratedValue
* @ORM\Column(name="id") * @ORM\Column(type="integer")
*/ */
private $id; private $id;
/** /**
@ -181,4 +181,32 @@ class SellRecord {
$this->date = $date; $this->date = $date;
} }
/**
* Constructor
*/
public function __construct() {
$this->productsSold = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add productsSold
*
* @param \AppBundle\Entity\ProductSold $productsSold
*
* @return SellRecord
*/
public function addProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
$this->productsSold[] = $productsSold;
return $this;
}
/**
* Remove productsSold
*
* @param \AppBundle\Entity\ProductSold $productsSold
*/
public function removeProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
$this->productsSold->removeElement( $productsSold );
}
} }

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

@ -2,26 +2,142 @@
namespace AppBundle\Entity; namespace AppBundle\Entity;
use AppBundle\Traits\Commentable;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* @ORM\Entity(repositoryClass="AppBundle\Repository\SellRecordRepository") * @ORM\Entity(repositoryClass="AppBundle\Repository\SellRecordRepository")
*/ */
class SellRecord { class SellRecord {
/**
* @ORM\ManyToOne(targetEntity="Product", inversedBy="sellRecords")
*/
private $products;
use Commentable;
/** /**
* @ORM\Id * @ORM\Id
* @ORM\GeneratedValue * @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* liste des produits de la vente
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="sellRecords")
*/
private $productsSold;
/**
* creation date
* @ORM\Column(type="datetime") * @ORM\Column(type="datetime")
*/ */
private $date; private $date;
/**
* total
* @ORM\Column(type="decimal", scale=2, nullable=false)
*/
private $amount; private $amount;
/**
* amount paid by client
* @ORM\Column(type="decimal", scale=2, nullable=true)
*/
private $paidByClient;
/**
* @var
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\Festival",inversedBy="sellRecords")
*/
private $festival;
/**
* owner of the selling account
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\User", inversedBy="sellRecords")
*/
private $user;
/**
* @return mixed
*/
public function getPaidByClient() {
return $this->paidByClient;
}
/**
* @param mixed $paidByClient
*/
public function setPaidByClient( $paidByClient ) {
$this->paidByClient = $paidByClient;
}
/**
* @return mixed
*/
public function getComment() {
return $this->comment;
}
/**
* @param mixed $comment
*/
public function setComment( $comment ) {
$this->comment = $comment;
}
/**
* @return mixed
*/
public function getProductsSold() {
return $this->productsSold;
}
/**
* @param mixed $productsSold
*/
public function setProductsSold( $productsSold ) {
$this->productsSold = $productsSold;
}
/**
* @return mixed
*/
public function getFestival() {
return $this->festival;
}
/**
* @param mixed $festival
*/
public function setFestival( $festival ) {
$this->festival = $festival;
}
/**
* @return mixed
*/
public function getUser() {
return $this->user;
}
/**
* @param mixed $user
*/
public function setUser( $user ) {
$this->user = $user;
}
/**
* @return mixed
*/
public function getAmount() {
return $this->amount;
}
/**
* @param mixed $amount
*/
public function setAmount( $amount ) {
$this->amount = $amount;
}
/** /**
* @return mixed * @return mixed
@ -59,10 +175,38 @@ class SellRecord {
} }
/** /**
* @param mixed $date * @param \DateTime $date
*/ */
public function setDate( $date ) { public function setDate( \DateTime $date ) {
$this->date = $date; $this->date = $date;
} }
/**
* Constructor
*/
public function __construct() {
$this->productsSold = new \Doctrine\Common\Collections\ArrayCollection();
}
/**
* Add productsSold
*
* @param \AppBundle\Entity\ProductSold $productsSold
*
* @return SellRecord
*/
public function addProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
$this->productsSold[] = $productsSold;
return $this;
}
/**
* Remove productsSold
*
* @param \AppBundle\Entity\ProductSold $productsSold
*/
public function removeProductsSold( \AppBundle\Entity\ProductSold $productsSold ) {
$this->productsSold->removeElement( $productsSold );
}
} }

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

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

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

@ -164,4 +164,86 @@ class User extends BaseUser {
public function getGoogleId() { public function getGoogleId() {
return $this->googleId; return $this->googleId;
} }
/**
* Add product
*
* @param \AppBundle\Entity\Product $product
*
* @return User
*/
public function addProduct(\AppBundle\Entity\Product $product)
{
$this->products[] = $product;
return $this;
}
/**
* Remove product
*
* @param \AppBundle\Entity\Product $product
*/
public function removeProduct(\AppBundle\Entity\Product $product)
{
$this->products->removeElement($product);
}
/**
* Remove productsSold
*
* @param \AppBundle\Entity\ProductSold $productsSold
*/
public function removeProductsSold(\AppBundle\Entity\ProductSold $productsSold)
{
$this->productsSold->removeElement($productsSold);
}
/**
* Add category
*
* @param \AppBundle\Entity\ProductCategory $category
*
* @return User
*/
public function addCategory(\AppBundle\Entity\ProductCategory $category)
{
$this->categories[] = $category;
return $this;
}
/**
* Remove category
*
* @param \AppBundle\Entity\ProductCategory $category
*/
public function removeCategory(\AppBundle\Entity\ProductCategory $category)
{
$this->categories->removeElement($category);
}
/**
* Add sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*
* @return User
*/
public function addSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
{
$this->sellRecords[] = $sellRecord;
return $this;
}
/**
* Remove sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*/
public function removeSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
{
$this->sellRecords->removeElement($sellRecord);
}
} }

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

@ -28,6 +28,112 @@ class User extends BaseUser {
private $googleAccessToken; private $googleAccessToken;
/**
* templates products
* @ORM\OneToMany(targetEntity="AppBundle\Entity\Product", mappedBy="user")
*/
private $products;
/**
* variabilised products sold
* @ORM\OneToMany(targetEntity="AppBundle\Entity\ProductSold", mappedBy="user")
*/
private $productsSold;
/**
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\ProductCategory", inversedBy="users")
*/
private $categories;
/**
* @return mixed
*/
public function getProductsSold() {
return $this->productsSold;
}
/**
* @return mixed
*/
public function addProductsSold( $product ) {
return $this->productsSold[] = $product;
}
/**
* @param mixed $productsSold
*/
public function setProductsSold( $productsSold ) {
$this->productsSold = $productsSold;
}
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\SellRecord", mappedBy="user")
*/
private $sellRecords;
/**
* @return mixed
*/
public function getSellRecords() {
return $this->sellRecords;
}
/**
* @param mixed $sellRecords
*/
public function setSellRecords( $sellRecords ) {
$this->sellRecords = $sellRecords;
}
/**
* @param mixed $sellRecords
*/
public function addSellRecords( $sellRecords ) {
$this->sellRecords[] = $sellRecords;
}
/**
* @return mixed
*/
public function getGoogleAccessToken() {
return $this->googleAccessToken;
}
/**
* @param mixed $googleAccessToken
*/
public function setGoogleAccessToken( $googleAccessToken ) {
$this->googleAccessToken = $googleAccessToken;
}
/**
* @return mixed
*/
public function getProducts() {
return $this->products;
}
/**
* @param mixed $products
*/
public function setProducts( $products ) {
$this->products = $products;
}
/**
* @return mixed
*/
public function getCategories() {
return $this->categories;
}
/**
* @param mixed $categories
*/
public function setCategories( $categories ) {
$this->categories = $categories;
}
/** /**
* Get id * Get id
* *
@ -37,27 +143,107 @@ class User extends BaseUser {
return $this->id; return $this->id;
} }
/**
* Set googleId
*
* @param string $googleId
*
* @return User
*/
public function setGoogleId( $googleId ) {
$this->googleId = $googleId;
return $this;
}
/**
* Get googleId
*
* @return string
*/
public function getGoogleId() {
return $this->googleId;
}
/** /**
* Set googleId * Add product
* *
* @param string $googleId * @param \AppBundle\Entity\Product $product
* *
* @return User * @return User
*/ */
public function setGoogleId($googleId) public function addProduct(\AppBundle\Entity\Product $product)
{ {
$this->googleId = $googleId; $this->products[] = $product;
return $this; return $this;
} }
/** /**
* Get googleId * Remove product
* *
* @return string * @param \AppBundle\Entity\Product $product
*/ */
public function getGoogleId() public function removeProduct(\AppBundle\Entity\Product $product)
{ {
return $this->googleId; $this->products->removeElement($product);
}
/**
* Remove productsSold
*
* @param \AppBundle\Entity\ProductSold $productsSold
*/
public function removeProductsSold(\AppBundle\Entity\ProductSold $productsSold)
{
$this->productsSold->removeElement($productsSold);
}
/**
* Add category
*
* @param \AppBundle\Entity\ProductCategory $category
*
* @return User
*/
public function addCategory(\AppBundle\Entity\ProductCategory $category)
{
$this->categories[] = $category;
return $this;
}
/**
* Remove category
*
* @param \AppBundle\Entity\ProductCategory $category
*/
public function removeCategory(\AppBundle\Entity\ProductCategory $category)
{
$this->categories->removeElement($category);
}
/**
* Add sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*
* @return User
*/
public function addSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
{
$this->sellRecords[] = $sellRecord;
return $this;
}
/**
* Remove sellRecord
*
* @param \AppBundle\Entity\SellRecord $sellRecord
*/
public function removeSellRecord(\AppBundle\Entity\SellRecord $sellRecord)
{
$this->sellRecords->removeElement($sellRecord);
} }
} }

0
src/AppBundle/Form/FestivalType.php Normal file → Executable file
View File

0
src/AppBundle/Form/ProductCategoryType.php Normal file → Executable file
View File

0
src/AppBundle/Form/ProductType.php Normal file → Executable file
View File

0
src/AppBundle/Form/SellRecordType.php Normal file → Executable file
View File

0
src/AppBundle/Repository/FestivalRepository.php Normal file → Executable file
View File

0
src/AppBundle/Repository/ProductCategoryRepository.php Normal file → Executable file
View File

0
src/AppBundle/Repository/ProductRepository.php Normal file → Executable file
View File

0
src/AppBundle/Repository/SellRecordRepository.php Normal file → Executable file
View File

0
src/AppBundle/Repository/StuffRepository.php Normal file → Executable file
View File

0
src/AppBundle/Repository/UserRepository.php Normal file → Executable file
View File

View File

View File

View File

View File

0
src/AppBundle/Traits/Commentable.php Normal file → Executable file
View File

0
src/AppBundle/Traits/Sellable.php Normal file → Executable file
View File

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

Some files were not shown because too many files have changed in this diff Show More