Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing SuluMedia Bundle Configurations #624

Open
alexander-schranz opened this issue Feb 3, 2021 · 6 comments
Open

Add missing SuluMedia Bundle Configurations #624

alexander-schranz opened this issue Feb 3, 2021 · 6 comments

Comments

@alexander-schranz
Copy link
Member

In #623 we added some configuration to the doc. We should also add the other available options to the configuration docs.

@TheCadien
Copy link
Member

A little bit offtopic.
@alexander-schranz , what do you think about an example for Extending Entities with the MediaBundle. (SuluMedia Attribute). And a Example for view Images in a ListView. Is the SuluMedia Bundle the right place ?
Im interested in do that

@niklasnatter
Copy link
Contributor

We dont have a lot of documentation about custom entities at the moment, so not sure what would be the best place for this. Would be okay for me to add a Use media in custom entity section - i think its better than having no documentation at all 🙂

@alexander-schranz
Copy link
Member Author

We had something similar one a project documentation there was a section Override Entities and then for every entity was a new sub section e.g.: Override Media Entity.

@alexander-schranz
Copy link
Member Author

alexander-schranz commented May 27, 2021

Docs did there look like this:

## Override Entities

### Override Media Entity

Create your new product entity class:

```php
<?php
// src/Entity/Product.php

namespace App\Entity;

use Doctrine\ORM\Mapping as ORM;
use .......\Media as SuluMedia;

/**
 * @ORM\Table(name="me_media")
 * @ORM\Entity
 */
class Media extends SuluMedia
{
}
```

Configure your new model class:

```yaml
# config/packages/sulu_product.yaml

sulu_media:
     objects:
         media:
             model: 'App\Entity\Media'
```

To add new fields to your entity have a look at the [Doctrine Mapping Documentation](https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/basic-mapping.html);

@TheCadien
Copy link
Member

@alexander-schranz I meant more the direction of bring the Media Bundle into your own Entity.
As an example "event" has a property "image" which has a doctrine relationship to "media".

And the doc should contain how about doctrine config (yml or xml) establishes this relationship.
Like here in Contact.
https://github.com/sulu/sulu/blob/2.x/src/Sulu/Bundle/ContactBundle/Resources/config/doctrine/Contact.orm.xml#L44

Another part should be how you can show the media in your ListView.
Like here:
https://github.com/sulu/sulu/blob/2.x/src/Sulu/Bundle/ContactBundle/Resources/config/lists/contacts.xml#L45

@alexander-schranz
Copy link
Member Author

Oh yeah then Usage media with custom entity or something similar would make sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants