Partage
  • Partager sur Facebook
  • Partager sur Twitter

NetBeans dernière version

    15 août 2018 à 20:44:13

    Bonjour à toutes et à tous! :)

    J'ai un soucis et je commence à ne plus en pouvoir! Lol

    Le message tout au dessous décrit mon problème; En effet, il lanbce une eception alors que tout est en ordre et mysql fait parti des bases de données accepté par netbeans.

    Les codes;

    ->rb-mysql.php

    ->

    <?php
    require __DIR__. "/../vendor/rb-mysql.php";
    require __DIR__. "../config-inc.php";
    require __DIR__. "/../vendor/autoload.php";
    
    //Pour faire des appels à NetBean
    use RedBeanPHP\Facade as Facade;
    
    if(empty(Facade::$currentDB)){
    	$dsn=sprintf('$s:host=$s;dbname=$s', DB_TYPE, DB_HOST, DB_NAME);
    	Facade::setup($dsn, DB_USER, DB_PASSWORD);
    }
    
    ?>
    ( ! ) Fatal error: Uncaught exception 'RedBeanPHP\RedException' with message 'Unsupported database (s).' in C:\wamp64\www\MaintInfo_NetBean\vendor\rb-mysql.php on line 10858
    ( ! ) RedBeanPHP\RedException: Unsupported database (s). in C:\wamp64\www\MaintInfo_NetBean\vendor\rb-mysql.php on line 10858
    Call Stack
    #TimeMemoryFunctionLocation
    1 0.0007 238384 {main}( ) ...\bootstrap.php:0
    2 0.0294 2751104 RedBeanPHP\Facade::setup( ) ...\bootstrap.php:11
    3 0.0294 2751408 RedBeanPHP\Facade::addDatabase( ) ...\rb-mysql.php:10738
    • Partager sur Facebook
    • Partager sur Twitter
      15 août 2018 à 22:12:13

      Bonjour,

      Ce qui est entre simples quotes est traité comme du texte, les variables ne sont pas interprétées.

      • Partager sur Facebook
      • Partager sur Twitter
        16 août 2018 à 9:30:18

        Bonjour,

        D'accord. J'aurais du être un peu plus clair.

        En fait, je suis un tuto vidéo où la personne a crée une classe config dans le core.

        <?php 
         
         /**
         *base de données
         */
         define('DB_TYPE','mysql');
         define('DB_HOST','localhost');
         define('DB_NAME','maintinfo');
         define('DB_USER','root');
         define('DB_PASSWORD','');
        
         /**
         *Config RedBean
         */
        define('REDBEAN_MODEL_PREFIX','\\MaintInfo\\Model');
        
        
        ?>

        Le truc, c'est que depuis NetBean a évolué et à tout regrouper en une seule classe (rb-mysql.php).

        Je suis débutant. Je ne sais ce que je dois mettre pour que la classe Facade reconnaisse mes éléments de connexion plus haut dans mon message.

        Merci d'avance

        • Partager sur Facebook
        • Partager sur Twitter
          16 août 2018 à 19:26:09

          Salut,

          Ligne 10 remplacer les $s par %s ;)

          • Partager sur Facebook
          • Partager sur Twitter
          Infoxp ici depuis 2007
            16 août 2018 à 20:39:28

            J'ai l'impression que tu essaye de suivre des tuto qui ont peut-être un niveau plus haut que ce que tu as actuellement. Ou alors tu n'essaye pas de comprendre les codes qui te sont montrer pendant la vidéo. Par exemple est-ce que tu connais sprintf ? As-tu lu la doc de php à sont sujet et les exemples montré ?

            J'aimerais bien savoir quel tuto tu suit aussi ^^

            -
            Edité par quenti77 16 août 2018 à 20:40:01

            • Partager sur Facebook
            • Partager sur Twitter
              17 août 2018 à 11:32:03

              Je suis un tuto sur la plateforme Elephorm. J'utilise NetBeans. Le problème, cest que le tuto vidéo n'est pas à jour et je cherche quelqu'un qui l'utilise??

              Je cherche à utliser la class RedBean_SimpleModel ou SimpleModel; à vrai dire, je ne sais pas car NetBeans a l'air d'évoluer très vite!

              Je cherchais justement un modéle MVC plus simple à mettr een place et le framwork NetBeans est au top apparemment comme laraval d'ailleurs mais beaucoup plus long à mettre en place car plus lourd.

              Mon but est de faire mon projet de cours en MVC classique puis avec les frameworks plus adapté au monde de l'entreprise.

              Ici, je bûche sur le problème énoncé ci dessus (NetBeans).

              ( ! ) Fatal error: Class 'Maintinfo\Model\SimpleModel' not found in C:\wamp64\www\MaintInfo_NetBean\src\Maintinfo\Model\Clients.php on line 6
              Call Stack
              #	Time	Memory	Function	Location
              1	0.0019	244976	{main}( )	...\Clients.php:0
              <?php
              
              namespace Maintinfo\Model;
              
              class Clients extends SimpleModel 
              {
              	//getters et setters de l'id
              	private $numcli;
              	public function getNumcli()
              	{
              		return $this->numcli;
              	}
              
              	public function setNumcli($v)
              	{
              		$this->numcli=$v;
              	}
              	
              
              	//de telcli
              	private $telcli;
              	public function getTelcli()
              	{
              		return $this->telcli;
              	}
              
              	public function setTelcli($v)
              	{
              		$this->telcli=$v;
              	}
              	
              	//de nomcli
              	private $nomcli;
              	public function getNomcli()
              	{
              		return $this->nomcli;
              	}
              
              	public function setNomcli($v)
              	{
              		$this->nomcli=$v;
              	}
              
              	//de adrcli
              	private $adrcli;
              	public function getAdrcli()
              	{
              		return $this->adrcli;
              	}
              
              	public function setAdrcli($v)
              	{
              		$this->adrcli=$v;
              	}
              	/*
              	//Je crée mon constructeur
              	public function __construct($numcli,$telcli,$nomcli,$adrcli)
              	{
              		$this->numcli=$numcli;
              		$this->telcli=$telcli;
              		$this->nomcli=$nomcli;
              		$this->adrcli=$adrcli;
              	}
              	*/
              }
              
              ?>
              Le truc c'est que je ne sais pas comment appeler la méthode SimpleModel du rb-mysql.
              Avec une autre classe et d'une façon différente pour trouver le bon appel mais rien..
              ( ! ) Fatal error: Class 'RedBean_SimpleModel' not found in C:\wamp64\www\MaintInfo_NetBean\src\Maintinfo\Model\Equipements.php on line 6
              Call Stack
              #TimeMemoryFunctionLocation
              1 0.0014 246464 {main}( ) ...\Equipements.php:0
              <?php 
              
              namespace Maintinfo\Model;
              
              class Equipements extends \RedBean_SimpleModel 
              {
              	//getter et setter de numser
              	private $numser;
              	public function getNumser()
              	{
              		return $this->numser;
              	}
              	// de dsgeqp
              	private $dsgeqp;
              	public function getDsgeqp()
              	{
              		return $this->dsgeqp;
              	}
              
              	public function setDsgeqp($v)
              	{
              		$this->dsgeqp=$dsgeqp;
              	}
              
              	//de dtederint
              	private $dtederint;
              	public function getDtererint()
              	{
              		$this->dtererint;
              	}
              
              	public function setDtererint($v)
              	{
              		$this->dtrerint=$dtererint;
              	}
              
              	//de perio
              	private $perio;
              	public function getPerio()
              	{
              		$this->perio;
              	}
              
              	public function setPerio($v)
              	{
              		$this->perio=$perio;
              	}
              	// de numcon
              	private $numcon;
              	public function getNumcon()
              	{
              
              		$this->numcon;
              	}
              	public function setNumcon($v)
              	{
              		$this->numcon=$numcon;
              	}
              
              	//Je crée mon constructeur
              	/*
              	public function __construct($numser,$dsgeqp,$dtderint,$perio,$numcon)
              	{
              		$this->numser=$numser;
              		$this->dsgeqp=$dsgeqp;
              		$this->dtderint=$dtderint;
              		$this->perio=$perio;
              		$this->numcon=$numcon;
              	}
              	*/
              
              }
              
              ?>

              Voici le code NetBeans (une partie, celle qui est concernée) Il n'y plus qu'à utliser la classe pour faire des appels

              namespace RedBeanPHP {
              
              use RedBeanPHP\OODBBean as OODBBean;
              
              /**
               * SimpleModel
               * Base Model For All RedBeanPHP Models using FUSE.
               *
               * RedBeanPHP FUSE is a mechanism to connect beans to posthoc
               * models. Models are connected to beans by naming conventions.
               * Actions on beans will result in actions on models.
               *
               * @file       RedBeanPHP/SimpleModel.php
               * @author     Gabor de Mooij and the RedBeanPHP Team
               * @license    BSD/GPLv2
               *
               * @copyright
               * copyright (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community
               * This source file is subject to the BSD/GPLv2 License that is bundled
               * with this source code in the file license.txt.
               */
              class SimpleModel
              {
              	/**
              	 * @var OODBBean
              	 */
              	protected $bean;
              
              	/**
              	 * Used by FUSE: the ModelHelper class to connect a bean to a model.
              	 * This method loads a bean in the model.
              	 *
              	 * @param OODBBean $bean bean to load
              	 *
              	 * @return void
              	 */
              	public function loadBean( OODBBean $bean )
              	{
              		$this->bean = $bean;
              	}
              
              	/**
              	 * Magic Getter to make the bean properties available from
              	 * the $this-scope.
              	 *
              	 * @note this method returns a value, not a reference!
              	 *       To obtain a reference unbox the bean first!
              	 *
              	 * @param string $prop property to get
              	 *
              	 * @return mixed
              	 */
              	public function __get( $prop )
              	{
              		return $this->bean->$prop;
              	}
              
              	/**
              	 * Magic Setter.
              	 * Sets the value directly as a bean property.
              	 *
              	 * @param string $prop  property to set value of
              	 * @param mixed  $value value to set
              	 *
              	 * @return void
              	 */
              	public function __set( $prop, $value )
              	{
              		$this->bean->$prop = $value;
              	}
              
              	/**
              	 * Isset implementation.
              	 * Implements the isset function for array-like access.
              	 *
              	 * @param  string $key key to check
              	 *
              	 * @return boolean
              	 */
              	public function __isset( $key )
              	{
              		return isset( $this->bean->$key );
              	}
              
              	/**
              	 * Box the bean using the current model.
              	 * This method wraps the current bean in this model.
              	 * This method can be reached using FUSE through a simple
              	 * OODBBean. The method returns a RedBeanPHP Simple Model.
              	 * This is useful if you would like to rely on PHP type hinting.
              	 * You can box your beans before passing them to functions or methods
              	 * with typed parameters.
              	 *
              	 * Note about beans vs models:
              	 * Use unbox to obtain the bean powering the model. If you want to use bean functionality,
              	 * you should -always- unbox first. While some functionality (like magic get/set) is
              	 * available in the model, this is just read-only. To use a model as a typical RedBean
              	 * OODBBean you should always unbox the model to a bean. Models are meant to
              	 * expose only domain logic added by the developer (business logic, no ORM logic).
              	 *
              	 * @return SimpleModel
              	 */
              	public function box()
              	{
              		return $this;
              	}
              
              	/**
              	 * Unbox the bean from the model.
              	 * This method returns the bean inside the model.
              	 *
              	 * Note about beans vs models:
              	 * Use unbox to obtain the bean powering the model. If you want to use bean functionality,
              	 * you should -always- unbox first. While some functionality (like magic get/set) is
              	 * available in the model, this is just read-only. To use a model as a typical RedBean
              	 * OODBBean you should always unbox the model to a bean. Models are meant to
              	 * expose only domain logic added by the developer (business logic, no ORM logic).
              	 *
              	 * @return OODBBean
              	 */
              	public function unbox()
              	{
              		return $this->bean;
              	}
              }
              }
              
              namespace RedBeanPHP {
              
              use RedBeanPHP\Observer as Observer;
              use RedBeanPHP\OODBBean as OODBBean;
              use RedBeanPHP\Observable as Observable;
              
              /**
               * RedBean Model Helper.
               *
               * Connects beans to models.
               * This is the core of so-called FUSE.
               *
               * @file    RedBeanPHP/ModelHelper.php
               * @author  Gabor de Mooij and the RedBeanPHP Community
               * @license BSD/GPLv2
               *
               * @copyright
               * copyright (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community
               * This source file is subject to the BSD/GPLv2 License that is bundled
               * with this source code in the file license.txt.
               */
              class SimpleModelHelper implements Observer
              {
              	/**
              	 * Gets notified by an observable.
              	 * This method decouples the FUSE system from the actual beans.
              	 * If a FUSE event happens 'update', this method will attempt to
              	 * invoke the corresponding method on the bean.
              	 *
              	 * @param string  $eventName i.e. 'delete', 'after_delete'
              	 * @param OODBean $bean      affected bean
              	 *
              	 * @return void
              	 */
              	public function onEvent( $eventName, $bean )
              	{
              		$bean->$eventName();
              	}
              
              	/**
              	 * Attaches the FUSE event listeners. Now the Model Helper will listen for
              	 * CRUD events. If a CRUD event occurs it will send a signal to the model
              	 * that belongs to the CRUD bean and this model will take over control from
              	 * there. This method will attach the following event listeners to the observable:
              	 *
              	 * - 'update'       (gets called by R::store, before the records gets inserted / updated)
              	 * - 'after_update' (gets called by R::store, after the records have been inserted / updated)
              	 * - 'open'         (gets called by R::load, after the record has been retrieved)
              	 * - 'delete'       (gets called by R::trash, before deletion of record)
              	 * - 'after_delete' (gets called by R::trash, after deletion)
              	 * - 'dispense'     (gets called by R::dispense)
              	 *
              	 * For every event type, this method will register this helper as a listener.
              	 * The observable will notify the listener (this object) with the event ID and the
              	 * affected bean. This helper will then process the event (onEvent) by invoking
              	 * the event on the bean. If a bean offers a method with the same name as the
              	 * event ID, this method will be invoked.
              	 *
              	 * @param Observable $observable object to observe
              	 *
              	 * @return void
              	 */
              	public function attachEventListeners( Observable $observable )
              	{
              		foreach ( array( 'update', 'open', 'delete', 'after_delete', 'after_update', 'dispense' ) as $eventID ) {
              			$observable->addEventListener( $eventID, $this );
              		}
              	}
              }
              }
              
              namespace RedBeanPHP {
              
              use RedBeanPHP\ToolBox as ToolBox;
              use RedBeanPHP\AssociationManager as AssociationManager;
              use RedBeanPHP\OODBBean as OODBBean;
              
              /**
               * RedBeanPHP Tag Manager.
               *
               * The tag manager offers an easy way to quickly implement basic tagging
               * functionality.
               *
               * Provides methods to tag beans and perform tag-based searches in the
               * bean database.
               *
               * @file       RedBeanPHP/TagManager.php
               * @author     Gabor de Mooij and the RedBeanPHP community
               * @license    BSD/GPLv2
               *
               * @copyright
               * copyright (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community
               * This source file is subject to the BSD/GPLv2 License that is bundled
              	 *
              
              
              • Partager sur Facebook
              • Partager sur Twitter
                17 août 2018 à 14:19:59

                Salut car SimpleModel est dans l'espace de nom
                RedBeanPHP

                Et ne s'appel pas RedBean_SimpleModel mais RedBeanPHP\SimpleModel ?

                -
                Edité par Infoxp 17 août 2018 à 14:20:10

                • Partager sur Facebook
                • Partager sur Twitter
                Infoxp ici depuis 2007
                  17 août 2018 à 14:41:20

                  GabrielJimenez a écrit:

                  Je cherchais justement un modéle MVC plus simple à mettr een place et le framwork NetBeans est au top apparemment comme laraval d'ailleurs mais beaucoup plus long à mettre en place car plus lourd.

                  Mon but est de faire mon projet de cours en MVC classique puis avec les frameworks plus adapté au monde de l'entreprise.

                  Une idée : Symfony.

                  L'install de Symfony arrive avec des fichiers de tests type "hello word !" dans le contrôleur et dans la vue.

                  Le tuto présent ici est bien détaillé et clair (et + à jour que le tuto que tu es en train de suivre, j'ai l'impression), et rapidement, tu auras modifié ton hello word pour mettre hello Gabriel.

                  Pour la partie Modèle, c'est rapide aussi .

                  -
                  Edité par LvParis 17 août 2018 à 14:42:03

                  • Partager sur Facebook
                  • Partager sur Twitter
                  "Une vie ne vaut rien, mais rien ne vaut une vie", Malraux

                  NetBeans dernière version

                  × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
                  × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
                  • Editeur
                  • Markdown