Jump to content

Search the Community

Showing results for tags 'fatal error php zf2'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 1 result

  1. Hello everyone ! I'm studying ZF2 and i would like to create with ZendFrameWork 2 an application about manage "Produit" ( in french ) or "Product" ( english ) and "Commande" ... Now before installing zf2 and configure all source codes , and when i would to add a product on a command i have this error : Fatal error: Call to a member function add() on a non-object in So i can't add a product on a command ; Here is Commande.php : <?php namespace Commande\Entity; use Doctrine\ORM\Mapping as ORM; //Marquer notre classe comme entité avec /** * @ORM\Entity * @ORM\Table(name="commande") */ //par défaut si on ne sécifie pas de table, Doctrine va stoker cette //entité dans une table du même nom class Commande { /** * @ORM\id * @ORM\GeneratedValue(strategy="AUTO") * @ORM\Column(type="integer") */ protected $id; /** @ORM\Column(type="string") */ protected $duree_commande; /** @ORM\Column(type="string") */ protected $date_commande; /** * @ORM\ManyToOne(targetEntity="Produit", inversedBy="commandes",cascade={"persist"}) * @ORM\JoinColumn(name="produit_id", referencedColumnName="id") */ protected $produits; public function __construct() { $this->produits = new \Doctrine\Common\Collections\ArrayCollection(); } public function getIdCommande() { return $this->id; } public function getDureeCommande() { return $this->duree_commande; } public function setIdCommande($id_commande) { $this->id = $id_commande; } public function setDureeCommande($duree_commande) { $this->duree_commande = $duree_commande; } public function getDateCommande() { return $this->date_commande; } public function setDateCommande($date_commande) { $this->date_commande = $date_commande; } public function getProduits() { return $this->produits; } public function addProduit($produit) { $this->produits->add($produit); } } and Produit.php : <?php namespace Commande\Entity; use Doctrine\ORM\Mapping as ORM; /** @ORM\Entity */ class Produit { /** * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") * @ORM\Column(type="integer") */ protected $id; /** @ORM\Column(type="string") */ protected $type_produit; /** @ORM\OneToMany(targetEntity="Commande", mappedBy="produit", cascade={"persist"}) */ protected $commande; public function __construct() { $this->commandes = new \Doctrine\Common\Collections\ArrayCollection(); } // getters/setters public function getIdProduit() { return $this->id; } public function getTypeProduit() { return $this->type_produit; } public function setIdProduit($id_produit) { $this->id = $id_produit; } public function setTypeProduit($type_produit) { $this->type_produit = $type_produit; } function getCommande() { return $this->commande; } function setCommande(Commande $commande) { $commande->addProduit($this); $this->commande = $commande; } } And i think that that the mapping is bad configured , because i want to creat a mapping like this : - just one product can be added on a command
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.