Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Delete Key in Models array possible
  • Hi,

    I have the following Model:

    Variable #1:
    (Object): Model_Animal

        protected _properties (Array, 6 elements)
        protected _observers (Array, 2 elements)
        protected _primary_key (Array, 1 element)
        protected _to_array_exclude (Array, 0 elements)
        protected _table_names_cached (Array, 1 element)
        protected _properties_cached (Array, 1 element)
        protected _views_cached (Array, 0 elements)
        protected _relations_cached (Array, 0 elements)
        protected _observers_cached (Array, 1 element)
        protected _cached_objects (Array, 1 element)
        protected _valid_relations (Array, 4 elements)
        protected _is_new (Boolean): false
        protected _frozen (Boolean): false
        protected _data (Array, 6 elements)
             id (String): "18" (2 characters)
             name (String): "ddd" (3 characters)
             age (String): "2" (1 characters)
             created_at (String): "1356881829" (10 characters)
             updated_at (String): "1356881829" (10 characters)
             xml : null
        protected _custom_data (Array, 0 elements)
        protected _original (Array, 6 elements)
        protected _data_relations (Array, 0 elements)
        protected _original_relations (Array, 0 elements)
        protected _reset_relations (Array, 0 elements)
        protected _view : null
        protected _iterable (Array, 0 elements)
    I would like to delete the key "xml" from the _data sub array.

    $animal = Arr::filter_keys($animal, array('_data.xml'), true); is not doing that job.

    Perhaps I only need to know, how I can access _data in this case.

    Thanks
    Kay
  • If xml  is a property (i.e. a column in your table), you can't remove it, you can only 'unset' it:
    unset($animal->xml);

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion