Welcome Guest, Not a member yet? Register   Sign In
Library -Object - Hydrate
#4

You can stick with your original idea, but...

public function hydrate(array $donnees = null)
 {
   parent::__construct();
   if ($donnees != null)
       foreach ($donnees as $key => $value)
       {
  
The intent of the above is to populate a Member object if one is being created, but to do nothing if the class
is being instantiated "just because", as the CI loader does.

btw, simply instantiating a model object, with an array of implied properties as a parameter, does nothing special in CI. Other frameworks might populate an object's properties under the same circumstance.
Reply


Messages In This Thread
Library -Object - Hydrate - by martin88 - 11-14-2016, 02:36 PM
RE: Library -Object - Hydrate - by ciadmin - 11-14-2016, 03:03 PM
RE: Library -Object - Hydrate - by martin88 - 11-14-2016, 03:21 PM
RE: Library -Object - Hydrate - by ciadmin - 11-14-2016, 04:05 PM
RE: Library -Object - Hydrate - by Narf - 11-15-2016, 02:56 AM
RE: Library -Object - Hydrate - by martin88 - 11-16-2016, 03:04 PM



Theme © iAndrew 2016 - Forum software by © MyBB