egeloen / IvoryCKEditorBundle

Provides a CKEditor integration for your Symfony project.
MIT License
336 stars 114 forks source link

Get error when try to call field on Entity persist #63

Closed reypm closed 10 years ago

reypm commented 11 years ago

Hi, maybe this isn't a issue but I'm getting "Column 'description' cannot be null" error while try to use the bundle. See I have this in my ProductType.php:

  $builder
            ->add('upc', 'text', array('required' => true))
            ->add('name', 'text', array('required' => true))
            ->add('description', 'ckeditor', array('required' => false))
            ->add('age_limit', 'text', array('required' => false));

Then in my controller I do this:

    $entityProduct = new Product ();

    $form = $this->createForm(new ProductType(), $entityProduct);
    $form->handleRequest($request);

    if ($form->isValid()) {
        $em = $this->getDoctrine()->getManager();

        $em->persist($entityProduct);
        $em->flush();
    }

For some reason or miss configuration from my part it's failing, where? Of course field have values (see the attached image)

1

egeloen commented 11 years ago

What is the Symfony & the bundle versions? Anyway, really strange... The only think I see is maybe a typo in your product description setter... :s

reypm commented 11 years ago

Both are in the latest version since I did a composer update recently and don't I have not errors in description setter

egeloen commented 11 years ago

@paquitodev I just try to reproduce your issue & it works :s There is definitively something wrong in your code but I don't find what it is.

egeloen commented 11 years ago

If you can fork the Symfony SE & reproduce the issue, it would help a lot to debug!

reypm commented 11 years ago

I can share my code since it belongs to the company I work for, any other way to get you tips or some other relevant info? maybe stacktrace?

Reynier Perez Mira eMail: reynierpm@gmail.com, admin@reynierpm.com Website: http://www.reynierpm.com Skype: reynierpm Mobile: +58 424-180.56.09

On Sat, Aug 31, 2013 at 1:30 AM, Eric GELOEN notifications@github.comwrote:

If you can fork the Symfony SE & reproduce the issue, it would help a lot to debug!

— Reply to this email directly or view it on GitHubhttps://github.com/egeloen/IvoryCKEditorBundle/issues/63#issuecomment-23602802 .

egeloen commented 11 years ago

@paquitodev If you can give me a pull premission on the repo & point me the controller which fails, I will see what can I do this week.

reypm commented 11 years ago

I leave you the controller and entity and form associated as gist since I can give your permissions on the repo (company policies) also I leave a image where you can see that prod_create[description] is empty even if I wrote something on it, I don't know why this is happening 1 will glad you can help me or point me in the right direction, many thanks

egeloen commented 11 years ago

@paquitodev I have forked the Symfony-SE and I can't reproduce your issue (https://github.com/egeloen/symfony-standard/compare/issue-63). The only way for me to help you is to reproduce your issue on this fork.

reypm commented 11 years ago

I still can't get it to work, I leave you the bundle, please take a look at create() method in ProductController.php and of course Entity and Form classes associated to this one.

reypm commented 11 years ago

Notice this $entityProduct->setDescription("Some temporal description"); around line 131 in ProductController.php, that works fine and persist to DB, also see around line 128 this other code echo $request->request->get('description') this doesn't print anything so description is coming empty

egeloen commented 11 years ago

Can you copy/paste the generated html form?

reypm commented 11 years ago

Here:

<div class="large-show large-offset-2 columns" id="content_row">
            <div id="product-search" style="display: none;">
                <form action="#" name="product-filter" id="product-filter">
                    <h4>Agregar producto</h4>

                    <p>Puede que el producto que deseas agrear ya exista en Wuelto.com.</p>
                    <p>Busca en nuestro catálogo y esto te ahorrará tiempo y te dará mejor posicionamiento.</p>

                    <div class="row">
                        <div class="large-12 columns">
                            <div class="searchOrAddProduct">
                                <label><h4>Buscar un producto</h4></label>
                                <input type="text" class="large-5 columns" placeholder="" id="query">
                                <p>Sino lo consigues en el catálogo</p> <button id="btn-add-product" class="btn">Agregar nuevo producto</button>
                            </div>
                        </div>
                    </div>
                </form>

                <div class="categories-left large-3 columns">
                    <ul>
                        <li><a>Todas las Categorias (12345)</a></li>
                        <li><a>Electronicos (12345)</a></li>
                        <li><a>Celulares y accesorios (12345)</a></li>
                        <li><a>Automotor (12345)</a></li>
                        <li><a>Todo lo demás (12345)</a></li>
                        <li><a>Salud y cuidado personal (12345)</a></li>
                        <li><a>Belleza (12345)</a></li>
                        <li><a>Videojuegos (12345)</a></li>
                        <li><a>Deportes y exteriores (12345)</a></li>
                        <li><a>Productos de oficina (12345)</a></li>
                        <li><a>Ropa y accesorios(12345)</a></li>
                        <li><a>Casa y cocina (12345)</a></li>
                        <li><a>Instrumentos musicales (12345)</a></li>
                        <li><a>Calzados (12345)</a></li>
                    </ul>
                </div>

                <div class="large-9 columns productListToAdd">
                    <div class="productListToAddHead">
                        <ul class="left">
                            <p>1 a 10 de 1984</p>
                        </ul>
                        <ul class="pagination right">
                            <li class="current"><a href="">1</a></li>
                            <li><a href="">2</a></li>
                            <li><a href="">3</a></li>
                            <li><a href="">4</a></li>
                            <li><a href="">5</a></li>
                            <li><a href="">6</a></li>
                            <li><a href="">7</a></li>
                            <li><a href="">8</a></li>
                            <li><a href="">9</a></li>
                            <li><a href="">10</a></li>
                            <li class="unavailable"><a href="">de</a></li>
                            <li><a href="">12</a></li>
                            <li class="arrow"><a href="">Siguiente »</a></li>
                        </ul>
                    </div>

                    <div class="productListToAddMany">
                        <div class="large-3 columns">
                            <img src="http://lorempixel.com/100/100/">
                        </div>
                        <div class="large-6 columns">
                            <p>iPhone 5 16GB desbloqueado blanco/negro</p>
                            <p>UPC 98765421345689</p>
                            <a class="seeDetails">Ver todos los detalles del producto</a>
                        </div>
                        <div class="large-3 columns">
                                                        <button data-id="B000BT4W2C" class="btn sell-product" type="button">Vender mi producto</button>
                        </div>
                    </div>
                </div>
            </div>

            <form style="" method="post" id="product_create" action="">
                <ul>
                    <li data-display="categories-picker" id="tab1"><a href="#">Seleccionar categoría</a></li>
                    <li data-display="product-select" id="tab2"><a href="#">Datos del Producto</a></li>
                    <li data-display="product-details" id="tab3"><a href="#">Detalles del Producto</a></li>
                    <li data-display="product-stock" id="tab4"><a href="#">Condiciones de Venta</a></li>
                </ul>

                <div id="categories-picker" style="display: none;">
                    <div class="product-left" id="cstep1">
                        <ul id="step1">
                                                            <li><a data-resp="main" data-id="1" class="step" href="#">Electrónica</a></li>
                                                            <li><a data-resp="main" data-id="3" class="step" href="#">Hogar</a></li>
                                                            <li><a data-resp="main" data-id="4" class="step" href="#">Ropa, Zapatos y Accesorios</a></li>
                                                            <li><a data-resp="main" data-id="5" class="step" href="#">Joyas y Relojes</a></li>
                                                            <li><a data-resp="main" data-id="6" class="step" href="#">Salud y Cuidado Personal</a></li>
                                                            <li><a data-resp="main" data-id="7" class="step" href="#">Deportes y Actividades Outdoors</a></li>
                                                            <li><a data-resp="main" data-id="8" class="step" href="#">Libros</a></li>
                                                    </ul>
                    </div><div id="cstep2" class="product-left"><ul id="step2"><li><a href="#" data-id="9" class="step">Computadoras y Tablets</a></li><li><a href="#" data-id="10" class="step">Vídeo Juegos y Cónsolas</a></li><li><a href="#" data-id="11" class="step">Celulares y Teléfonos</a></li><li><a href="#" data-id="12" class="step">Instrumentos Musicales</a></li><li><a href="#" data-id="13" class="step">Cámaras, Fotografía y Accesorios</a></li><li><a href="#" data-id="14" class="step">Tv, Audio y Video</a></li></ul></div><div id="cstep3" class="product-left"><ul id="step3"><li><a href="#" data-id="15" class="step">Repuestos Para Celulares</a></li><li><a href="#" data-id="16" class="step">Accesorios para celulares</a></li><li><a href="#" data-id="17" class="step">Celulares</a></li><li><a href="#" data-id="18" class="step">Forros y Protectores</a></li></ul></div><div id="cstep4" class="product-left"><ul id="step4"><li><a href="#" data-id="670" class="step">Alcatel</a></li><li><a href="#" data-id="671" class="step">Apple Iphone</a></li><li><a href="#" data-id="672" class="step">Blackberry</a></li><li><a href="#" data-id="673" class="step">Huawei</a></li><li><a href="#" data-id="674" class="step">Kyocera</a></li><li><a href="#" data-id="675" class="step">LG</a></li><li><a href="#" data-id="676" class="step">Motorola</a></li><li><a href="#" data-id="677" class="step">Nokia</a></li><li><a href="#" data-id="678" class="step">Palm Treo</a></li><li><a href="#" data-id="679" class="step">Samsung</a></li><li><a href="#" data-id="680" class="step">Sony Ericson</a></li><li><a href="#" data-id="681" class="step">HTC</a></li><li><a href="#" data-id="682" class="step">Otros</a></li></ul></div>
                <div id="cstep5" class="product-left"><button id="next_step" name="next_step" type="button"> Continuar ...</button></div></div>
                <div style="" id="product-select">
                    <input type="hidden" value="673" name="selected_category" id="selected_category">
                    <div>
                        <div class="first-intro-line"><p>Ingresa fotos de tu producto</p></div>
                        <div class="second-intro-line"><p>Puedes subir hasta 5 fotos en alta calidad para que los compradores puedan hacer <strong>zoom</strong> y agrandar la imagen.</p></div>
                    </div>

                    <div>
                        <div class="custom-input-file product-left">
                            <input type="file" class="input-file" name="mediabundle_mediatype[file]" id="picture_1">
                            <div class="archivo">Seleccionar ...</div>
                            <img style="display:none" alt="your image" src="#" class="picture_1">
                        </div>
                        <div class="custom-input-file product-left">
                            <input type="file" class="input-file" name="mediabundle_mediatype[file]" id="picture_2">
                            <div class="archivo">Seleccionar ...</div>
                            <img style="display:none" alt="your image" src="#" class="picture_2">
                        </div>
                        <div class="custom-input-file product-left">
                            <input type="file" class="input-file" name="mediabundle_mediatype[file]" id="picture_3">
                            <div class="archivo">Seleccionar ...</div>
                            <img style="display:none" alt="your image" src="#" class="picture_3">
                        </div>
                        <div class="custom-input-file product-left">
                            <input type="file" class="input-file" name="mediabundle_mediatype[file]" id="picture_4">
                            <div class="archivo">Seleccionar ...</div>
                            <img style="display:none" alt="your image" src="#" class="picture_4">
                        </div>
                        <div class="custom-input-file product-left">
                            <input type="file" class="input-file" name="mediabundle_mediatype[file]" id="picture_5">
                            <div class="archivo">Seleccionar ...</div>
                            <img style="display:none" alt="your image" src="#" class="picture_5">
                        </div>
                    </div>

                    <div style="clear: both"></div>

                    <div>
                        <div class="first-intro-line"><p>Describe tu producto</p></div>
                        <div class="second-intro-line"><p><strong>*</strong> datos obligatorios.</p></div>
                    </div>

                    <label class="required" for="product_upc">Upc</label>

                    <input type="text" required="required" name="product[upc]" id="product_upc">

                   <label class="required" for="product_name">Name</label>

                        <input type="text" required="required" name="product[name]" id="product_name">
                                            <label for="product_description">Description</label>

                            <textarea name="product[description]" id="product_description" style="visibility: hidden; display: none;"></textarea><div lang="en" aria-labelledby="cke_product_description_arialbl" role="application" dir="ltr" class="cke_1 cke cke_reset cke_chrome cke_editor_product_description cke_ltr cke_browser_gecko" id="cke_product_description"><span class="cke_voice_label" id="cke_product_description_arialbl">Rich Text Editor, product_description</span><div role="presentation" class="cke_inner cke_reset"><span style="height: auto; -moz-user-select: none;" role="presentation" class="cke_top cke_reset_all" id="cke_1_top"><span class="cke_voice_label" id="cke_7">Editor toolbars</span><span onmousedown="return false;" aria-labelledby="cke_7" role="group" class="cke_toolbox" id="cke_1_toolbox"><span role="toolbar" class="cke_toolbar" id="cke_8"><span class="cke_toolbar_start"></span><span role="presentation" class="cke_toolgroup"><a onclick="CKEDITOR.tools.callFunction(5,this);return false;" onmousedown="return CKEDITOR.tools.callFunction(4,event);" onfocus="return CKEDITOR.tools.callFunction(3,event);" onkeydown="return CKEDITOR.tools.callFunction(2,event);" onblur="this.style.cssText = this.style.cssText;" aria-haspopup="false" aria-labelledby="cke_9_label" role="button" hidefocus="true" tabindex="-1" title="Bold" class="cke_button cke_button__bold  cke_button_off" id="cke_9"><span style="background-image:url(http://wuelto.com/bundles/ivoryckeditor/plugins/icons.png?t=D6IE);background-position:0 -24px;background-size:auto;" class="cke_button_icon cke_button__bold_icon">&nbsp;</span><span class="cke_button_label cke_button__bold_label" id="cke_9_label">Bold</span></a><a onclick="CKEDITOR.tools.callFunction(9,this);return false;" onmousedown="return CKEDITOR.tools.callFunction(8,event);" onfocus="return CKEDITOR.tools.callFunction(7,event);" onkeydown="return CKEDITOR.tools.callFunction(6,event);" onblur="this.style.cssText = this.style.cssText;" aria-haspopup="false" aria-labelledby="cke_10_label" role="button" hidefocus="true" tabindex="-1" title="Italic" class="cke_button cke_button__italic  cke_button_off" id="cke_10"><span style="background-image:url(http://wuelto.com/bundles/ivoryckeditor/plugins/icons.png?t=D6IE);background-position:0 -48px;background-size:auto;" class="cke_button_icon cke_button__italic_icon">&nbsp;</span><span class="cke_button_label cke_button__italic_label" id="cke_10_label">Italic</span></a></span><span class="cke_toolbar_end"></span></span><span role="toolbar" class="cke_toolbar" id="cke_11"><span class="cke_toolbar_start"></span><span role="presentation" class="cke_toolgroup"><a onclick="CKEDITOR.tools.callFunction(13,this);return false;" onmousedown="return CKEDITOR.tools.callFunction(12,event);" onfocus="return CKEDITOR.tools.callFunction(11,event);" onkeydown="return CKEDITOR.tools.callFunction(10,event);" onblur="this.style.cssText = this.style.cssText;" aria-haspopup="false" aria-labelledby="cke_12_label" role="button" hidefocus="true" tabindex="-1" title="Insert/Remove Numbered List" class="cke_button cke_button__numberedlist  cke_button_off" id="cke_12"><span style="background-image:url(http://wuelto.com/bundles/ivoryckeditor/plugins/icons.png?t=D6IE);background-position:0 -1344px;background-size:auto;" class="cke_button_icon cke_button__numberedlist_icon">&nbsp;</span><span class="cke_button_label cke_button__numberedlist_label" id="cke_12_label">Insert/Remove Numbered List</span></a><a onclick="CKEDITOR.tools.callFunction(17,this);return false;" onmousedown="return CKEDITOR.tools.callFunction(16,event);" onfocus="return CKEDITOR.tools.callFunction(15,event);" onkeydown="return CKEDITOR.tools.callFunction(14,event);" onblur="this.style.cssText = this.style.cssText;" aria-haspopup="false" aria-labelledby="cke_13_label" role="button" hidefocus="true" tabindex="-1" title="Insert/Remove Bulleted List" class="cke_button cke_button__bulletedlist  cke_button_off" id="cke_13"><span style="background-image:url(http://wuelto.com/bundles/ivoryckeditor/plugins/icons.png?t=D6IE);background-position:0 -1296px;background-size:auto;" class="cke_button_icon cke_button__bulletedlist_icon">&nbsp;</span><span class="cke_button_label cke_button__bulletedlist_label" id="cke_13_label">Insert/Remove Bulleted List</span></a><span role="separator" class="cke_toolbar_separator"></span><a onclick="CKEDITOR.tools.callFunction(21,this);return false;" onmousedown="return CKEDITOR.tools.callFunction(20,event);" onfocus="return CKEDITOR.tools.callFunction(19,event);" onkeydown="return CKEDITOR.tools.callFunction(18,event);" onblur="this.style.cssText = this.style.cssText;" aria-haspopup="false" aria-labelledby="cke_14_label" role="button" hidefocus="true" tabindex="-1" title="Decrease Indent" class="cke_button cke_button__outdent cke_button_disabled " id="cke_14"><span style="background-image:url(http://wuelto.com/bundles/ivoryckeditor/plugins/icons.png?t=D6IE);background-position:0 -1032px;background-size:auto;" class="cke_button_icon cke_button__outdent_icon">&nbsp;</span><span class="cke_button_label cke_button__outdent_label" id="cke_14_label">Decrease Indent</span></a><a onclick="CKEDITOR.tools.callFunction(25,this);return false;" onmousedown="return CKEDITOR.tools.callFunction(24,event);" onfocus="return CKEDITOR.tools.callFunction(23,event);" onkeydown="return CKEDITOR.tools.callFunction(22,event);" onblur="this.style.cssText = this.style.cssText;" aria-haspopup="false" aria-labelledby="cke_15_label" role="button" hidefocus="true" tabindex="-1" title="Increase Indent" class="cke_button cke_button__indent  cke_button_off" id="cke_15"><span style="background-image:url(http://wuelto.com/bundles/ivoryckeditor/plugins/icons.png?t=D6IE);background-position:0 -984px;background-size:auto;" class="cke_button_icon cke_button__indent_icon">&nbsp;</span><span class="cke_button_label cke_button__indent_label" id="cke_15_label">Increase Indent</span></a></span><span class="cke_toolbar_end"></span></span><span role="toolbar" class="cke_toolbar" id="cke_16"><span class="cke_toolbar_start"></span><span role="presentation" class="cke_toolgroup"><a onclick="CKEDITOR.tools.callFunction(29,this);return false;" onmousedown="return CKEDITOR.tools.callFunction(28,event);" onfocus="return CKEDITOR.tools.callFunction(27,event);" onkeydown="return CKEDITOR.tools.callFunction(26,event);" onblur="this.style.cssText = this.style.cssText;" aria-haspopup="false" aria-labelledby="cke_17_label" role="button" hidefocus="true" tabindex="-1" title="Link" class="cke_button cke_button__link  cke_button_off" id="cke_17"><span style="background-image:url(http://wuelto.com/bundles/ivoryckeditor/plugins/icons.png?t=D6IE);background-position:0 -1224px;background-size:auto;" class="cke_button_icon cke_button__link_icon">&nbsp;</span><span class="cke_button_label cke_button__link_label" id="cke_17_label">Link</span></a><a onclick="CKEDITOR.tools.callFunction(33,this);return false;" onmousedown="return CKEDITOR.tools.callFunction(32,event);" onfocus="return CKEDITOR.tools.callFunction(31,event);" onkeydown="return CKEDITOR.tools.callFunction(30,event);" onblur="this.style.cssText = this.style.cssText;" aria-haspopup="false" aria-labelledby="cke_18_label" role="button" hidefocus="true" tabindex="-1" title="Unlink" class="cke_button cke_button__unlink cke_button_disabled " id="cke_18"><span style="background-image:url(http://wuelto.com/bundles/ivoryckeditor/plugins/icons.png?t=D6IE);background-position:0 -1248px;background-size:auto;" class="cke_button_icon cke_button__unlink_icon">&nbsp;</span><span class="cke_button_label cke_button__unlink_label" id="cke_18_label">Unlink</span></a></span><span class="cke_toolbar_end"></span></span><span role="toolbar" class="cke_toolbar" id="cke_19"><span class="cke_toolbar_start"></span><span role="presentation" class="cke_toolgroup"><a onclick="CKEDITOR.tools.callFunction(37,this);return false;" onmousedown="return CKEDITOR.tools.callFunction(36,event);" onfocus="return CKEDITOR.tools.callFunction(35,event);" onkeydown="return CKEDITOR.tools.callFunction(34,event);" onblur="this.style.cssText = this.style.cssText;" aria-haspopup="false" aria-labelledby="cke_20_label" role="button" hidefocus="true" tabindex="-1" title="About CKEditor" class="cke_button cke_button__about  cke_button_off" id="cke_20"><span style="background-image:url(http://wuelto.com/bundles/ivoryckeditor/plugins/icons.png?t=D6IE);background-position:0 0px;background-size:auto;" class="cke_button_icon cke_button__about_icon">&nbsp;</span><span class="cke_button_label cke_button__about_label" id="cke_20_label">About CKEditor</span></a></span><span class="cke_toolbar_end"></span></span></span></span><div role="presentation" class="cke_contents cke_reset" id="cke_1_contents" style="height: 200px;"><span class="cke_voice_label" id="cke_27">Press ALT 0 for help</span><iframe frameborder="0" src="" style="width: 100%; height: 100%;" class="cke_wysiwyg_frame cke_reset" title="Rich Text Editor, product_description" aria-describedby="cke_27" tabindex="0" allowtransparency="true"></iframe></div><span role="presentation" class="cke_bottom cke_reset_all" id="cke_1_bottom" style="-moz-user-select: none;"><span onmousedown="CKEDITOR.tools.callFunction(0, event)" title="Resize" class="cke_resizer cke_resizer_vertical cke_resizer_ltr" id="cke_1_resizer">◢</span><span class="cke_voice_label" id="cke_1_path_label">Elements path</span><span aria-labelledby="cke_1_path_label" role="group" class="cke_path" id="cke_1_path"><span class="cke_path_empty">&nbsp;</span></span></span></div></div>

            <script type="text/javascript">
            var CKEDITOR_BASEPATH = '/bundles/ivoryckeditor/';
        </script>

        <script src="/bundles/ivoryckeditor/ckeditor.js?0.1" type="text/javascript"></script>

        <script type="text/javascript">
            if (CKEDITOR.instances['product_description']) {
                delete CKEDITOR.instances['product_description'];
            }

            CKEDITOR.replace('product_description', {"toolbar":[["Bold","Italic"],["NumberedList","BulletedList","-","Outdent","Indent"],["Link","Unlink"],["About"]]});
        </script>

                    <label for="product_age_limit">Age limit</label>

                    <input type="text" name="product[age_limit]" id="product_age_limit">

                    <input type="hidden" value="f19fb0a5b4bc9ad5428faf68d079c98c36006915" name="product[_token]" id="product__token">

                    <div style="clear: both"></div>

                    <button id="step2-backward" type="button">Anterior</button>
                    <button id="step2-forward" type="button">Siguiente</button>
                </div>
                <div style="display:none" id="product-details">
                </div>
                <div style="display:none" id="product-stock">
                </div>
            </form>
            <div style="display: none" id="sell-existent-product"></div>
            <script>
                var company_id = "1";
            </script>
        </div>
egeloen commented 11 years ago

I see your textarea is not visible by default. Have you try to remove the inline style? (Not sure if it is related or not...)

reypm commented 11 years ago

Nop, I remove the visible: none and the error remains

egeloen commented 10 years ago

@paquitodev Any news?

egeloen commented 10 years ago

@paquitodev What the state of your issue?

egeloen commented 10 years ago

Closing as there is no feedback since 8 months.