public static function Find(&$object, $data)
    {
      $data = Ensure::Input($data);
      $is_str = $data->is_string();

      if (!isset($data))
        return $object;
      /**
       * certain objects cannot
       * be resolved without there parents
       * this is 'only' the case when arity is 1
       * otherwise we follow normal flow
       */
      if ($object->loads->silent && $is_str)
        return $object;
      /**
       * if we have a singleton
       * treat as primary key then
       * invoke create call with
       * in some cases the primary method can be
                   * create in others get
       */
      if ($is_str && !$object->loads->silent)
        if ($object->loads->primary == 'create' || !isset($object->loads->primary))
          return $object->create(array(
            $object->loads->primary => $data
          ));
        else
          return $object->get($data->get());

      $input = Ensure::Input($data);

      $data = $input->get();

      if (in_array("id", array_keys($data)))
        $object->get($data['id']);	
      else
        $object->create($data);
    }
public static function Find(&$object, $data)
    {
      $data = Ensure::Input($data);
      $is_str = $data->is_string();

      if (!isset($data))
        return $object;
      /**
       * certain objects cannot
       * be resolved without there parents
       * this is 'only' the case when arity is 1
       * otherwise we follow normal flow
       */
      if ($object->loads->silent && $is_str)
        return $object;
      /**
       * if we have a singleton
       * treat as primary key then
       * invoke create call with
       * in some cases the primary method can be
                   * create in others get
       */
      if ($is_str && !$object->loads->silent)
        if ($object->loads->primary == 'create' || !isset($object->loads->primary))
          return $object->create(array(
            $object->loads->primary => $data
          ));
        else
          return $object->get($data->get());

      $input = Ensure::Input($data);

      $data = $input->get();

      if (in_array("id", array_keys($data)))
        $object->get($data['id']);	
      else
        $object->create($data);
    }
public static function Find ( & $ object , $ data ) { $ data = Ensure :: Input ( $ data ) ; $ is_str = $ data -> is_string ( ) ; if ( ! isset ( $ data ) ) return $ object ; /**
       * certain objects cannot
       * be resolved without there parents
       * this is 'only' the case when arity is 1
       * otherwise we follow normal flow
       */ if ( $ object -> loads -> silent && $ is_str ) return $ object ; /**
       * if we have a singleton
       * treat as primary key then
       * invoke create call with
       * in some cases the primary method can be
                   * create in others get
       */ if ( $ is_str && ! $ object -> loads -> silent ) if ( $ object -> loads -> primary == 'create' || ! isset ( $ object -> loads -> primary ) ) return $ object -> create ( array ( $ object -> loads -> primary => $ data ) ) ; else return $ object -> get ( $ data -> get ( ) ) ; $ input = Ensure :: Input ( $ data ) ; $ data = $ input -> get ( ) ; if ( in_array ( "id" , array_keys ( $ data ) ) ) $ object -> get ( $ data [ 'id' ] ) ; else $ object -> create ( $ data ) ; }
Main function figure out whether
to create or get this object.

@param object: Catapult Model Object
@param data: EnsuredInput
Main function figure out whether to create or get this object .